411 Star 6.1K Fork 1.3K

GVPdromara / MaxKey

 / 详情

用nginx反向代理MaxKey出现跳转异常

已完成
创建于  
2021-04-09 15:29

评论 (2)

Lonewolf 创建了任务
Lonewolf 关联仓库设置为dromara/MaxKey
Lonewolf 修改了描述
MaxKeyTop 优先级设置为次要
展开全部操作日志

需要调整配置信息,去适配nginx反向代理

MaxKeyTop 添加了bug(已删除)标签
MaxKeyTop 添加了
 
question
标签
MaxKeyTop 移除了bug(已删除)标签

请仔细参考
https://gitee.com/dromara/MaxKey/blob/master/maxkey-core/src/main/java/org/maxkey/web/WebContext.java


    /**
     * get Http Context full Path,if port equals 80 or 443 is omitted.
     * 
     * @return String eg:http://192.168.1.20:9080/webcontext or
     *         http://www.website.com/webcontext
     */
    public static String getHttpContextPath(HttpServletRequest httpServletRequest) {
        ApplicationConfig applicationConfig = (
                ApplicationConfig) WebContext.getBean("applicationConfig");
        
        _logger.trace("Config ServerPrefix " + applicationConfig.getServerPrefix());
        _logger.trace("Config DomainName " + applicationConfig.getDomainName());
        _logger.trace("ServerName " + httpServletRequest.getServerName());
        
        String httpContextPath ="";
        
        if (httpServletRequest.getServerName().matches(ipAddressRegex)
        		||httpServletRequest.getServerName().equalsIgnoreCase("localhost")) {
        	String scheme = httpServletRequest.getScheme().toLowerCase();
            httpContextPath = scheme + "://"+httpServletRequest.getServerName();
        }else {
        	httpContextPath = applicationConfig.getServerName();
        }

        int port = httpServletRequest.getServerPort();
	    if(!(port==80 || port==443)){
	        httpContextPath +=  ":" + port;
	    }
        httpContextPath += httpServletRequest.getContextPath() + "";
        
        _logger.trace("httpContextPath " + httpContextPath);
        return httpContextPath;

    }
MaxKeyTop 负责人设置为MaxKeyTop
MaxKeyTop 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
5531506 maxkeytop admin 1666757757 1094016 juexun 1618643345
Java
1
https://gitee.com/dromara/MaxKey.git
git@gitee.com:dromara/MaxKey.git
dromara
MaxKey
MaxKey

搜索帮助

53164aa7 5694891 3bd8fe86 5694891