jcoglan / restore

Simple remoteStorage server written in Node.js
293 stars 27 forks source link

Allow execution behind a reverse proxy #15

Closed vtheuer closed 10 years ago

vtheuer commented 10 years ago

It would be nice to be able to run a server behind a reverse proxy such as nginx, thus allowing the user to access it using a url like domain.com/remoteStorage/ .

michielbdejong commented 10 years ago

@vtheuer what is currently preventing you from doing that? You could run reStore on a local port on your server, and then configure nginx to proxy to that?

vtheuer commented 10 years ago

I use a nginx to proxy_pass my restore server on /rs/, but all links on the UI start with /. Therfore, clicking on the signup link will open /signup and not /rs/signup. I might be missing something but I didn't find any option to modify that. I tried removing the leading / from links and form actions, but there seems to be other routes that start with a / because I couldn't manage to use my server using /rs/

silverbucket commented 10 years ago

One easy work-around is to proxy on a sub-domain. Like: rs.example.com, then you can leave all of the paths default.

On Wed, Apr 2, 2014 at 8:53 AM, vtheuer notifications@github.com wrote:

I use a nginx to proxy_pass my restore server on /rs/, but all links on the UI start with /. Therfore, clicking on the signup link will open /signup and not /rs/signup. I might be missing something but I didn't find any option to modify that. I tried removing the leading / from links and form actions, but there seems to be other routes that start with a / because I couldn't manage to use my server using /rs/

— Reply to this email directly or view it on GitHubhttps://github.com/jcoglan/restore/issues/15#issuecomment-39294008 .

jcoglan commented 10 years ago

Is there an HTTP convention for notifying a backend server about a pathname prefix on a proxy so that it knows it should prefix generated URLs? A special header, maybe? In the Ruby world I know Rack uses SCRIPT_NAME for this but that's a hangover from CGI, not an HTTP header.

silverbucket commented 10 years ago

I don't think there's an HTTP convention, some proxying software probably has was to map URIs, but I don't know if nginx does or not.

On Wed, Apr 2, 2014 at 2:44 PM, James Coglan notifications@github.comwrote:

Is there an HTTP convention for notifying a backend server about a pathname prefix on a proxy so that it knows it should prefix generated URLs? A special header, maybe? In the Ruby world I know Rack uses SCRIPT_NAME for this but that's a hangover from CGI, not an HTTP header.

— Reply to this email directly or view it on GitHubhttps://github.com/jcoglan/restore/issues/15#issuecomment-39325169 .

vtheuer commented 10 years ago

I run other applications behind my nginx, and they have different ways of defining the pathname prefix. Some node applications (tiddlyWiki for instance) take it from a command line parameter or json configuration, others (such as the deluge web interface) use a custom http header to tell the client side which url should be used.

The subdomain work-around should indeed be a good solution in my case. Thank you!

jcoglan commented 10 years ago

The Remote Storage spec advises that the service should not be run on the same origin as other services, so I think subdomains are the way to go.

silverbucket commented 10 years ago

Good point, there can be security issues with that.

On Tue, Apr 22, 2014 at 2:13 PM, James Coglan notifications@github.comwrote:

The Remote Storage spec advises that the service should not be run on the same origin as other services, so I think subdomains are the way to go.

— Reply to this email directly or view it on GitHubhttps://github.com/jcoglan/restore/issues/15#issuecomment-41032212 .