Artifactory和NGINX proxy_pass的问题

罗布·拉查姆

我在使用nginx和代理传递时遇到问题。我已经建立了一个JFrog Artifactory实例,并成功地将我的域指向了它。但是,该端口仍显示在“ URL to file”(图像)中。这是我的nginx配置

server {
  
server_name repo.hyperiamc.com;

if ($http_x_forwarded_proto = '') {
    set $http_x_forwarded_proto  $scheme;
}
## Application specific logs
rewrite ^/$ /ui/ redirect;
rewrite ^/ui$ /ui/ redirect;
chunked_transfer_encoding on;
client_max_body_size 0;
location / {
    proxy_read_timeout  2400s;
    proxy_pass_header   Server;
    proxy_cookie_path   ~*^/.* /;
    proxy_pass          http://x.x.x.x:8082;
    proxy_next_upstream error timeout non_idempotent;
    proxy_next_upstream_tries    1;
    proxy_set_header    X-JFrog-Override-Base-Url $http_x_forwarded_proto://$host:$server_port;
    proxy_set_header    X-Forwarded-Port  $server_port;
    proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_set_header    Host              $http_host;
    proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;

    location ~ ^/artifactory/ {
        proxy_pass    http://x.x.x.x:8081;
    }
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/repo.hyperiamc.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/repo.hyperiamc.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot }

访问该URL的网站后,它似乎只是要归档的URL。我已将我的基本URL设置在工件内部以匹配代理的URL。

拉克希米·普拉萨德(Lakshmi Prasad)

我相信这是由于我们在配置中设置的标头值。换行。发件人:proxy_set_header X-JFrog-Override-Base-Url $ http_x_forwarded_proto:// $ host:$ server_port;

收件人:proxy_set_header X-JFrog-Override-Base-Url $ http_x_forwarded_proto:// $ host;

希望这可以帮助。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章