Rstudio-server and shiny-server on same server, same port

407 views
Skip to first unread message

Robin Cura

unread,
Nov 25, 2013, 10:10:06 AM11/25/13
to shiny-...@googlegroups.com
Hi,

I was wondering :
Is it possible to have both rstudio-server and shiny-server listening to the same port ?

The perfect solution would be to be able to define rstudio-server config inside the shiny-server configuration, ie. allowing to put different server_name to each "application" (shiny app, rstudio session etc.).

Any idea ?

Thanks,

Robin

Robin Cura

unread,
Dec 30, 2013, 12:01:20 PM12/30/13
to shiny-...@googlegroups.com
Hi all,

Has anyone any clue on this ?

Thanks,

Robin


2013/11/25 Robin Cura <robin...@gmail.com>

Jeff Allen

unread,
Dec 30, 2013, 11:53:30 PM12/30/13
to shiny-...@googlegroups.com
Unfortunately, it's not possible to have these both running on the same port.

That being said, you may be able to simulate this effect by running a Proxy (nginx if you care about supporting websockets in Shiny Server, or Apache/HAProxy) that passes some traffic to RStudio and some to Shiny Server (perhaps by hostname or URI). 

The other option would be to setup Shiny Server on that port and RStudio on another port. Then you could setup a Redirect to send some traffic to another URL (or port). So perhaps you could define a location in Shiny Server that redirects all traffic for the `/rstudio/` location to "myserver.com:1234" which is where RStudio runs? Not a perfect solution, but would certainly be the easiest.

Hope that helps!
Jeff

Robin Cura

unread,
Dec 31, 2013, 6:18:06 AM12/31/13
to Jeff Allen, shiny-...@googlegroups.com
Hi Jeff,

Thanks for your reply.
First of all, I think there's a little error in the redirect doc. The example should be (well, at least, that's how I got it working) :

# Define a location at the base URL of this 'server'
location / {
  # base config
}
# Redirect traffic from '/shinyApp1/' to 'http://server.com' temporarily.
location /shinyApp1 {
    redirect "http://server.com" 302 true;
  }

Your answer is a good start from me, but in fact, I'm experiencing the same issue I had :
I can only have the 80 port that is open on my server (network security, and don't have the hand to open another widely).
So, using a redirect works fine (I can open 8787 in local network to test), it redirects well to myserv:8787, but this doesn't solve the problem of accessing rstudio-server from outside the local network, as it still blocks the 8787 port.

So, I think I'll go for a proxy using nginx, seems I could use the doc you made for rstudio-server.

Just hoping this won't mess with my "shiny-server internal config" :)

Cheers,

Robin

2013/12/31 Jeff Allen <je...@rstudio.com>

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jeff Allen

unread,
Dec 31, 2013, 3:44:24 PM12/31/13
to Robin Cura, shiny-...@googlegroups.com
Thanks for the tip, Robin! I'll get that fixed ASAP.

It sounds like you're on the right track if you're limited to only one externally facing port.

Jeff
December 31, 2013 at 5:18 AM
Hi Jeff,

Thanks for your reply.
First of all, I think there's a little error in the redirect doc. The example should be (well, at least, that's how I got it working) :

# Define a location at the base URL of this 'server'
location / {
# base config
}
# Redirect traffic from '/shinyApp1/' to 'http://server.com' temporarily.
location /shinyApp1 {
redirect "http://server.com" 302 true;
}

Your answer is a good start from me, but in fact, I'm experiencing the same issue I had :
I can only have the 80 port that is open on my server (network security, and don't have the hand to open another widely).
So, using a redirect works fine (I can open 8787 in local network to test), it redirects well to myserv:8787, but this doesn't solve the problem of accessing rstudio-server from outside the local network, as it still blocks the 8787 port.

So, I think I'll go for a proxy using nginx, seems I could use the doc you made for rstudio-server.

Just hoping this won't mess with my "shiny-server internal config" :)

Cheers,

Robin
December 30, 2013 at 10:53 PM
Unfortunately, it's not possible to have these both running on the same port.

That being said, you may be able to simulate this effect by running a Proxy (nginx if you care about supporting websockets in Shiny Server, or Apache/HAProxy) that passes some traffic to RStudio and some to Shiny Server (perhaps by hostname or URI). 

The other option would be to setup Shiny Server on that port and RStudio on another port. Then you could setup a Redirect to send some traffic to another URL (or port). So perhaps you could define a location in Shiny Server that redirects all traffic for the `/rstudio/` location to "myserver.com:1234" which is where RStudio runs? Not a perfect solution, but would certainly be the easiest.

Hope that helps!
Jeff

On Monday, December 30, 2013 11:01:20 AM UTC-6, Robin Cura wrote:
--
You received this message because you are subscribed to a topic in the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/shiny-discuss/UhOzmfxYOu4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to shiny-discus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages