nginx use container name to proxy

This commit is contained in:
qiaofeng1227 2023-05-25 11:11:14 +08:00
parent 16dbb3f486
commit 20ce88c2bc

View file

@ -25,7 +25,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://172.17.0.1:5000/;
proxy_pass http://websoft9-appmanage:5000/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
@ -37,7 +37,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://172.17.0.1:9091/;
proxy_pass http://websoft9-portainer:9000/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
@ -77,14 +77,19 @@ server {
sub_filter_once off;
}
location ^~ /kopia {
location /kopia {
set $auth $cookie_auth;
if ($auth = "") {
set $auth $arg_id;
add_header Set-Cookie "auth=$auth; Path=/; HttpOnly";
}
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Prefix /kopia;
proxy_pass http://kopia:51515/;
proxy_pass http://websoft9-kopia:51515/;
rewrite ^/kopia/(.*)$ /$1 break;
proxy_http_version 1.1;
proxy_redirect off;
@ -93,6 +98,7 @@ server {
proxy_set_header Connection $http_connection;
proxy_cache_bypass $http_secret_header;
proxy_set_header Accept-Encoding "";
proxy_set_header Authorization "Basic $auth";
add_header Pragma "no-cache";
add_header Cache-Control "no-cache";
# source changes