Issue doing reverse proxy using apache with subdomain

Issue doing reverse proxy using apache with subdomain

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

Solutions/Answers:

Solution 1:

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

References

Related:  Nginx wont leave! how to remove it [closed]