Forum: Ruby on Rails Apache as proxy for webrick

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ecf15b0bccba46fe1285f392b3ad0dde?d=identicon&s=25 Tom Styles (Guest)
on 2006-04-06 16:49
Hello,

We have a webrick server running our nice app, and an apache server
being used to serve the rest of the site and act as a proxy for the
webrick app.

<code>
<IfModule mod_proxy.c>

    ProxyRequests Off

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass /appname http://server.com:3000
    ProxyPassReverse /appname http://server.com:3000
    ProxyPreserveHost On

</IfModule>
</code>

If you go to http://server.com/appname everything seem to work fine,
however when the app needs to redirect it strips the appname out of the
path. e.g. http://server.com/redirectcontroller/redirectaction
Apache gets all confused because it can't find the file and returns a
404 error.

Does anyone know how to stop the /appname from being removed from the
URL?
Thanks
Tom
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-04-06 17:27
(Received via mailing list)
On 4/6/06, Tom Styles <tom.styles@nottscc.gov.uk> wrote:
>     ProxyPass /appname http://server.com:3000
>     ProxyPassReverse /appname http://server.com:3000
>     ProxyPreserveHost On

> Does anyone know how to stop the /appname from being removed from the
> URL?

Couldn't you change your proxy to use http://server.com:3000/appname
and then add "/appname" to your routes?

-- James
Ecf15b0bccba46fe1285f392b3ad0dde?d=identicon&s=25 Tom Styles (Guest)
on 2006-04-06 17:41
> Couldn't you change your proxy to use http://server.com:3000/appname
> and then add "/appname" to your routes?

I'd rather avoid having the port in the path at all unless there is no
way around it.

How would I go about altering all routes to use a preset root directory
name?

Cheers
Tom
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-04-06 18:01
(Received via mailing list)
On 4/6/06, Tom Styles <tom.styles@nottscc.gov.uk> wrote:
>
> > Couldn't you change your proxy to use http://server.com:3000/appname
> > and then add "/appname" to your routes?
>
> I'd rather avoid having the port in the path at all unless there is no
> way around it.

I meant this:

   ProxyPass /appname http://server.com:3000/appname
   ProxyPassReverse /appname http://server.com:3000/appname

You were already using the port, so I didn't think you wanted to get rid
of it.

> How would I go about altering all routes to use a preset root directory
> name?

  # Allow downloading Web Service WSDL as a file with an extension
  # instead of a file named 'wsdl'
  map.connect 'appname/:controller/service.wsdl', :action => 'wsdl'

  # Install the default route as the lowest priority.
  map.connect 'appname/:controller/:action/:id'

I haven't tried this, but I don't see why it wouldn't work either.

-- James
This topic is locked and can not be replied to.