auth0 / shiny-auth0

Auth0 shiny proxy
51 stars 43 forks source link

Shiny Server using Auth0: 404 error #20

Open chenx2018 opened 4 years ago

chenx2018 commented 4 years ago

I have an ubuntu server running shiny server + nginx.

I followed this tutorial to protect access to it by using Auth0.

Now, when I navigate to "example.com/" I get a login page, and when logging in I get the shiny server welcome page.

However, when I try to access any of my specific apps ("example.com/appName"), I get a 404 Not Found error.

This is all that is printed in the screen:

Not Found
404
Error: Not Found
at /home/ubuntu/shiny-auth0/app.js:75:13
at Layer.handle [as handle_request] (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:317:13)
at /home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:335:12)
at next (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/home/ubuntu/shiny-auth0/node_modules/body-parser/lib/types/urlencoded.js:91:7)
at Layer.handle [as handle_request] (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:317:13)
at /home/ubuntu/shiny-auth0/node_modules/express/lib/router/index.js:284:7

How can I solve this and access the apps?

Thanks!

YO-SC commented 4 years ago

Any solutions for this issue yet? I am experiencing the same thing, I think it has something to do with app.js and routes/index.js

dave-mills commented 3 years ago

I think it's because the app is using example.com/reports/ for the shiny apps, rather than the root domain. Looking at routes/index.js, line 17 - 29, it redirects the user to "/reports" after authentication and as soon as you land on the root domain. Then the routes/reports.js does the actual proxying to Shiny.

So - seems like the shiny apps should be accessed at e.g. "example.com/reports/appName". Not super intuitive, but at least it seems to work.

dave-mills commented 3 years ago

I just added a PR #25 to add an automatic redirect to add in the 'reports/' to the url, so users can use example.com/appName as they might expect from other Shiny servers, and they'll automatically be redirected to example.com/reports/appName (where the Shiny app is being proxied) - in case it's of any use to people still having this issue.

coeusanalytics commented 3 years ago

Hi there,

I am having a similar issue to @chenx2018. Similar setup: Ubuntu Server + Shiny Server + nginx + Auth0. I too have followed the Auth0 tutorial.

I have my domain (assume https://example.com) and https://example.com/shiny/ point to port 3838. I have reconfigured the nginx file to be redirected to port 3000 which should theoretically open up the Auth0 login page.

However, it does not and it results in my custom 404 error page and the URL ends up as https://example.com/reports/. If I type in https://examples.com/shiny/callback - it successfully opens the Auth0 login page.

Is there a solution or at least a workaround?

Thanks.