I'm running into the following issue where I would like to be able to access a proxy passed location (React/NextJs webApp in a hosted docker container) from a home website with a trailing slash and without a trailing slash.
Currently, when I hit:
http://my-website.com/test # this works
But when I hit:
http://my-website.com/test/ # this fails with a 404
I'd like to be able to hit both of these urls. What am I missing?
### Default Server ###
server {
listen 80;
root /usr/site;
if ($http_x_forwarded_proto = "http") {
return 301 https://$host$request_uri;
}
location ~/test(.*)$ {
set $upstream_endpoint http://$docker_container_url;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_pass $upstream_endpoint$1/;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}