Rstudio workbench behind AWS ALB has redirect responses to HTTP

I have RStudio workbench (server pro) container (listening to port 8787) deployed in an ECS cluster behind an ALB. ALB exposes HTTPS (e.g. https://rstudio.acme.com) for traffic to workbench. The homepage loads up fine but when logging in (XHR POST to https://rstudio.acme.com/auth-do-sign-in), the response is a 302 redirect with location http://rstudio.acme.com/auth-sign-in . As the browser can not reach port 80, it errors out.
Is there a way to force workbench to respond with https instead of http?
I tried setting ssl-redirect-http=1 but it seems to have no effect.
AWS ALBs forward the header X-Forwarded-Proto already so am not sure what's going on.
How can I make workbench aware that the protocol should be https instead of http?

Hi @pkrstudio,

Thanks for reaching out. Since you're using RStudio Workbench, you have access to our premium support and I'd encourage you to file a support ticket. Directions are here: How do I submit a Support ticket? – RStudio Support

If you could add a little detail about your authentication setup, that would be great. I assume you're using SAML or OAuth, since there's a redirect involved?

--Alex

Hi Alex,

Am not using SAML. RStudio does a POST-redirect for login. That's the redirect am talking about.
Yes, I submitted a support ticket as well. And resolved the issue by looking at RStudio code.

Found issue in the way RStudio figures out if it is behind proxy at https://github.com/rstudio/rstudio/blob/51009f4cff7b0f45f9bd8762d7c0514b0de537bd/src/cpp/core/http/Request.cpp#L62

Instead of getting proxied base URI, it gets internal URI.
The protocol is then taken from 'X-RStudio-Proto' header than 'X-Forwarded-For' header.

Solved my issue by adding setting 'X-RStudio-Proto' header to https in nginx.site.conf.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.