1

I am trying to do a mod_proxy implementation of a sintra application using a subdirectory uri on the proxy host. Here is my apache proxy config area:

ProxyRequests Off
ProxyPass /api/ http://127.0.0.1:9292/
ProxyPassReverse /api/ http://127.0.0.1:9292/
ProxyPreserveHost on

The problem I am running into, is that the links within the sinatra rendered page are not resulting in the /api prefix on the links... For example, when I do to('/some_page') within an erb template, it gives me

http://www.externalhost.com/some_page

instead of

http://www.externalhost.com/api/some_page

Does anyone know how to properly do this where the subdirectory will be honored in generating the url? To run the backend server, I'm simply using the default as: rackup config.ru where my config is:

require 'rubygems'
load File.join(File.dirname(__FILE__), 'app.rb')
run App
ejlevin1
  • 735
  • 5
  • 15

1 Answers1

2
ProxyRequests Off
ProxyPass /api/ http://127.0.0.1:9292/api/
ProxyPassReverse /api/ http://127.0.0.1:9292/api/
ProxyPreserveHost on
apache
  • 46
  • 1
  • I was trying to do this without having to have /api/ on the destination, but doing so worked correctly. Thanks! – ejlevin1 Jan 09 '12 at 23:07