I have an app (RStudio) running behind a proxy using Caddy. I map it to a subdirectory like so:
proxy /rstudio rstudio:8787 {
without /rstudio
header_upstream Host {host}/rstudio
transparent
websocket
}
redir /rstudio /rstudio/ 307
(In this case Caddy and RStudio are running as separate docker images, so rstudio
is the name of the Docker service)
However, when RStudio redirects the user, it sends them to the top top level, not pages under my.site/rstudio
. So to log in, it redirects to my.site/auth-sign-in
, not my.site/rstudio/auth-sign-in
.
I attempted to fix this by adding another redirect:
redir /auth-sign-in /rstudio/auth-sign-in 307
This works to get to the login page, but after I log in it then redirects to my.site/
, not my.site/rstudio/
. I attempted to use the referrer, like so
redir 307 {
if {>Referrer} has /rstudio
/ /rstudio
}
This doesn’t seem to work. It may not recognize the referrer?