I recently successfully deployed a ShinyProxy + app using SSL with nginx and certbot in the following manner:
- Dockerize ShinyProxy + app and launch on port
127.0.0.1:5001
.
- Create Nginx config and
proxy_pass
to 127.0.0.1:5001
.
- Secure using
certbot
.
This is the successful nginx.conf location
section:
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_redirect off;
proxy_read_timeout 90s;
proxy_pass http://127.0.0.1:5001;
}
This nicely redirects me to https://app.myweb.com/login
as I have set up a CNAME
. Important to note, {ShinyProxy} redirects to the login
at the end automatically. On successful login the url redirects to https://app.myweb.com/app/website
.
What I really struggle with is the following: adding a location block
or as I understand it, include my upstream
block into my downstream
(correct my terms if I am wrong). So, have my url go from https://app.myweb.com/login
to https://app.myweb.com/dashboard/login
using the following configuration in nginx:
location /dashboard/ { # THIS IS WHAT I WANT TO ADD
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_redirect off;
proxy_read_timeout 90s;
proxy_pass http://127.0.0.1:5001;
}
All that happens is, if I type https://app.myweb.com/dashboard/
it doesn't go to https://app.myweb.com/dashboard/login
as I would expect, but redirects back to https://app.myweb.com/login
which 404
's.
Any advice on what I am doing wrong?