I have 2 servers A and B
I've configured my server A with NGINX and a website. I want to reverse proxy all the traffic that is coming to my server A with the /path1/ to my server B's domain with /ptah2/.
my server A NGINX config:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /ssl/certificate.crt;
ssl_certificate_key /ssl/privkey.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ecdh_curve X25519:P-256:P-384:P-521;
server_name server.a.domain;
index index.html index.htm;
root /www/html;
error_page 400 = /400.html;
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security "max-age=63072000" always;
location /path1/
{
proxy_redirect off;
proxy_pass server.b.domain;
proxy_http_version 1.1;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
}
server {
listen 80;
listen [::]:80;
server_name server.a.domain;
return 301 https://$http_host$request_uri;
}
my webpage is loading normally and its ok, But my data is not reaching server B when im using /path2/
I want to pass the traffic exactly as is to server B with /path2/ if the /path1/ is called.