I have nginx listening on port 80 and an R Shiny Server behind a firewall at port 3838. There is a reverse proxy to send all requests to the /internal directory through a password dialog on the browser before it goes to the Shiny server.
I am trying to figure out how to turn URLs that the user enters like http://my.domain/internal/SomeProgram to http://my.domain/internal/SomeProgram.Rmd so that the Shiny server can process them. I don't know whether to use try_files or something like:
if (!-e $request_filename) {
rewrite ^(.*)$ /$1.Rmd;
}
This part below works, but I don't know where or how to insert the above code (or use completely different code) to make the extensionless to .Rmd conversion:
location /internal {
auth_basic "Admin Area";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://localhost:3838/internal/;
proxy_redirect / $scheme://$http_host/;
}
location /shiny/ {
rewrite ^/shiny/(.*)$ /$1 break;
proxy_pass http://localhost:3838/;
proxy_redirect / $scheme://$http_host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
proxy_buffering off;
}
Any insights would be greatly appreciated. Thanks :)