【问题标题】:nginx reverse proxy+rundeck is not wokring as expectednginx 反向代理+rundeck 未按预期工作
【发布时间】:2021-08-22 00:33:48
【问题描述】:

我想使用带有 NBINX 反向代理的 rundeck,但没有按预期工作。

rundeck 位于: http://host.domain:4440/rundeck nginx 反向代理位于: https://host.domain/rundeck

nginx的配置:

   location /rundeck/ {
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Proto https;
        proxy_pass http://192.168.1.102:4440/rundeck/;
}

rundeck 的定制: RUNDECK_SERVER_CONTEXTPATH=/rundeck RUNDECK_SERVER_FORWARDED=true

https://host.domain/rundeck 显示:

有没有办法解决这个问题? 浏览器的开发控制台显示以下错误: 无法读取:https://host.domain/rundeck/assets/menu/knockout.mapping.min.js.map HTTP 错误 404、net::ERR_HTTP_RESPONSE_CODE_FAILURE

解决方案: 使用 http 反向代理而不是 https 反向代理:

apache2 as a http reveverse proxy:
    ProxyRequests Off
    ProxyPass /rundeck/ http://host.domain:4440/rundeck/
    ProxyPassReverse /rundeck/ http://host.domain:4440/rundeck/

nginx as a reverse proxy:
    location /rundeck/ {
        proxy_http_version 1.1;
        proxy_pass http://host.domain:4440/rundeck/;
    }

framework.properties:
framework.rundeck.url = http://host.domain/rundeck/

rundeck-config.properties:
grails.serverURL=http://host.domain/rundeck/
server.servlet.context-path = /rundeck

【问题讨论】:

    标签: nginx reverse-proxy rundeck


    【解决方案1】:

    确保 grails.serverURL(在 rundeck-config.properties 文件中,RUNDECK_GRAILS_URL Docker env var)参数指向代理退出 URL(在您的情况下为 https://host.domain/rundeck)。

    另外,请尝试使用最新版本的 Firefox/Chrome (same issue)。

    【讨论】:

    • grails.serverURL 是:grails.serverURL=host.domain/rundeckframework.rundeck.url 是:framework.rundeck.url = host.domain/rundeck
    • 我可能会找到一个解决方案:如果反向代理是 http,而不是 https,则反向代理工作正常。可能需要 http 反向代理 http rundeck。
    • 太棒了,请添加您的解决方案作为答案:-)
    【解决方案2】:

    一个解决方案:使用http反向代理而不是https反向代理:

    apache2 as a http reveverse proxy:
        ProxyRequests Off
        ProxyPass /rundeck/ http://rundeckhost.domain:4440/rundeck/
        ProxyPassReverse /rundeck/ http://rundeckhost.domain:4440/rundeck/
    
    nginx as a reverse proxy:
        location /rundeck/ {
            proxy_http_version 1.1;
            proxy_pass http://rundeckhost.domain:4440/rundeck/;
        }
    
    framework.properties:
    framework.rundeck.url = http://reverseproxy.domain/rundeck/
    
    rundeck-config.properties:
    grails.serverURL=http://reverseproxy.domain/rundeck/
    server.servlet.context-path = /rundeck
    

    【讨论】:

      【解决方案3】:

      假设您的 rundeck 正在使用域名“internal-rundeck.com:4440”的内部服务器中运行,并且您希望通过 nginx 在“external-rundeck.com/rundeck”域上公开它---按照以下步骤操作

      第 1 步: 在甲板上

      RUNDECK_GRAILS_URL="external-rundeck.com/rundeck"
      RUNDECK_SERVER_CONTEXTPATH=/="/rundeck"
      RUNDECK_SERVER_FORWARDED=true
      

      在部署文件中设置以上配置为环境变量

      第 2 步: 在 nginx 中

      location /rundeck/ {
      
      proxy_pass http://internal-rundeck.com:4440/rundeck/;
      
      }
      

      在你的 nginx 配置文件中添加它就可以了

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-11-23
        • 2018-04-17
        • 1970-01-01
        • 2016-06-28
        • 2023-01-20
        • 1970-01-01
        • 2023-04-05
        • 2020-04-25
        相关资源
        最近更新 更多