修改在存在代理的情况下,上传本地文件获取URL不正确问题

This commit is contained in:
yangxu998@gmail.com 2026-01-13 22:57:47 +08:00
parent b16d50390e
commit 49cf815aa7

View File

@ -26,6 +26,10 @@ public class ServerConfig
public static String getDomain(HttpServletRequest request)
{
String origin = request.getHeader("origin");
if (origin != null && origin.length() > 0) {
return origin;
}
StringBuffer url = request.getRequestURL();
String contextPath = request.getServletContext().getContextPath();
return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString();