【问题标题】:Grails Spring Security appending :8080 to URL when behind Apache proxyGrails Spring Security 在 Apache 代理后面附加:8080 到 URL
【发布时间】:2013-09-11 18:42:47
【问题描述】:

在生产中,我的 Grails 应用程序在 Tomcat 端口 8080 上运行,并位于 Apache 代理后面;端口 80。除身份验证外,所有功能均有效。当用户尝试登录应用程序时,Spring Security 会将 :8080 附加到目标 URL 并且连接超时,因为无法路由请求。

我已经在 config.groovy 中设置了以下内容但没有成功:

    grails.serverURL = "http://domain.tld/${appName}"
grails.plugins.springsecurity.portMapper.httpPort = "80"
grails.plugins.springsecurity.portMapper.httpsPort = "443"

当我尝试使用内置身份验证或 OpenID 时会出现此问题。在我的托管服务提供商通过堵住一个洞并开始从外部阻止端口 8080 进行更改之前,该应用程序已经运行了 6 个多月。

我只需要 Spring Security 来编写没有 :8080 的 URL

感谢任何帮助,谢谢!

更新 最后问题出在我使用的主机上。与 Apache ProxyPass 有关。相同的应用程序在新的生产 VPS 上运行良好。谢谢大家的意见。

【问题讨论】:

  • 为什么不把Tomcat的端口也改成80呢?
  • 你能发布你的apache配置吗?我还在 Apache 代理后面的 Tomcat 上运行的应用程序中使用 Spring Security,我没有任何问题,也不需要在 Config.groovy 上设置任何特殊内容...

标签: grails redirect spring-security port target


【解决方案1】:

将以下内容添加到您的 Config.groovy 文件中:

grails.server.port.http = 80

【讨论】:

    【解决方案2】:

    我会考虑将tomcat更改为80端口并将所有apache请求转发到80端口。注意使用spring security的x-forward proto header标签。

    【讨论】:

    • 在这种情况下不能将 Tomcat 更改为端口 80。
    【解决方案3】:

    已在问题中回答

    mod_rewrite not working to secure grails application

    tomcat 配置更改就像一个魅力。

    【讨论】:

      猜你喜欢
      • 2012-07-28
      • 2016-05-20
      • 2016-02-16
      • 2013-05-07
      • 2022-11-16
      • 2016-06-16
      • 2014-10-16
      • 2011-09-05
      • 2017-09-28
      相关资源
      最近更新 更多