I have an app that I have placed behind NGINX as a reverse proxy and everything is working great except for...
I can't work out how to have the address bar on a browser only show the domain name and not the path
For example my server returns things like
sub.domain.com/BNS/Panel/1/stuff
This is not meaningful for a user and a user would never type this in, so I would like to restrict the browser address bar to only show
sub.domain.com
I've been searching high and low but with no success.
The current directive looks like this:
server {
server_name sub.domain.com;
location = / {
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://1.2.3.4:8080/path/file.html;
proxy_cookie_path ~*^/.* /;
proxy_intercept_errors on;
}
location / {
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://1.2.3.4:8080/path/file.html;
proxy_cookie_path ~*^/.* /;
proxy_intercept_errors on;
}
listen 443 ssl; # managed by Certbot
ssl_certificate path/to/key.pem; # managed by Certbot
ssl_certificate_key path/to/key.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = sub.domain.com) {
return 301 https://$host;
} # managed by Certbot
server_name sub.domain.com;
listen 80;
return 404; # managed by Certbot
}
Thanks for any assistance or links to somewhere I haven't found yet.