Sort of. I simplified my example but it is actually like this:
RewriteRule ^/foo/([^\/]*)/([^\/]*)$
http://localhost:3838/?x=$1&y=$2 [P]
Now, regarding the problem. There was no:
/etc/shiny-server/shiny-server.conf
but I created one. When I run shiny-server, it picks up that instead of:
/usr/lib/node_modules/shiny-server/config/default.config
The app location is:
location / {
app_dir /var/shiny-server/www/app;
}
I try to access the app with params.
http://example.org/foo/bar/baz
I get the following error for socksjs-0.3.min.js (line 27)
NetworkErorr: 404 Not Found -
http://exmaple.org/foo/bar/baz__sockjs__/info
I'd like to keep /foo/ because that's just where I indicate the app as
part of the URI. It is not a physical directory.
The app directory: /var/shiny-server/www/app/ also contains a copy of
shiny JavaScript and CSS (slider, bootsrap files) if that matters. Which
seems to load fine, but I had to put a symbolik link from
/var/www/
example.org/shiny to /var/shiny-server/www/app/shiny
-Sarven
On 07/02/2013 10:03 PM, Joe Cheng wrote:
> Oh, you just want to serve up a single Shiny app directly on the root
> URL; create the following config file at
> /etc/shiny-server/shiny-server.conf (replace the value in bold):
>
>
> |run_as shiny;
>
> # The directory where application log files should be written to.
> # This directory must exist--it will NOT be automatically created.
> log_dir /var/shiny-server/log/;
>
> server {
> listen 3838;
>
> location / {
> app_dir*/path-to-your-appdir;*
> <mailto:
in...@csarven.ca <mailto:
in...@csarven.ca>>> wrote:
>
> On 07/01/2013 11:37 PM, Joe Cheng wrote:
>
> Oh, sorry. You're not using Shiny Server, so please
> disregard the
> previous question.
>
>
> If using shiny-server, how would this setup be different?
>
>
> Shiny Server uses sockjs instead of a "raw" websocket, and it
> tells the
> browser to load the sockjs JS library through an http URL. (Or
> it used
> to; this bug is fixed in our GitHub repo)
>
>
> The issue I have is that I run shiny like:
>
> R -e "shiny::runApp('foo')"
>
> which runs on
http://localhost:8100/
>
> There is an Apache VirtualHost for
example.org
> <
http://example.org> <
http://example.org>
> with a reverse proxy:
>
> RewriteRule ^/([^/]*)/([^/]*)
> ws://localhost:8100/?x=foo&y=____bar [P]
>
>
> When the application tries to start, it is attempting to
> connect to:
>
> ws://
example.org <
http://example.org> <
http://example.org>
>
>
>
> That's fine. Cross origin only applies to what the browser sees;
> and as
> far as the browser's concerned, localhost:8100 doesn't exist.
> The page
> URL is
http://example.org and the websocket is at
> ws://
example.org <
http://example.org>
> <
http://example.org>.
>
>
>
> Would it be possible to simply start the shiny application at
>
http://example.org/ instead of
http://localhost:8100/ or is that
> only possible through shiny-server?
>
>
> That would be an awful idea because it would require you to run
> as root.
> You also wouldn't be able to support SSL directly out of the R
> process.
>
>
> I tried it through shiny-server in any case with this:
>
> listen 8100;
> server_name localhost;
>
> Keeping Apache settings as is. Still no go.
>
> I'm beginning to doubt that Apache websocket is working
> properly.
>
>
> Can you try again but without server_name? server_name looks at the
> value in the Host header that comes from the browser, so that
> would be
>
example.org <
http://example.org> <
http://example.org> or
> something. Better to just leave
>
> server_name off altogether unless you actually are running
> virtual hosts.
>
> I would expect this to work because SockJS knows how to use
> regular HTTP
> requests instead of websockets if the latter fails. And since
> the page
> is coming up in the first place, it seems regular HTTP requests
> should work.
>
> However you may need to install shiny-server from github, due to
> the old
> bug I mention at the top of this email:
> sudo npm install -g
>
https://github.com/rstudio/__shiny-server/tarball/master
> <
https://github.com/rstudio/shiny-server/tarball/master>
>
>
> What you are saying is that, using shiny-server from github, it
> won't bother with websockets and so it means that I should be able
> to use http in my Apache rewrite and proxy?
>
> Tried that. Also I have the git repo cloned and did:
>
> sudo npm install -g shiny-server
>
>
>
> Right now I have this line in my Apache VirtualHost with ServerAlias
>
example.org <
http://example.org>:
>
> RewriteRule ^/([^\/]*)/([^\/]*)$
>
http://localhost:3838/?__datasetX=$1&datasetY=$2
> <
http://localhost:3838/?datasetX=$1&datasetY=$2> [P]
>
> /usr/lib/node_modules/shiny-__server/config/default.config is as is