I've not made the decision if this sounds like an Apache problem, or perhaps a Sinatra problem, essentially, there exists a couple of little applications running on one server, we deploy all of them with just built-in webrick instances and employ apache to re-route individuals demands by subdomain right port. I'm using gollum the industry sinatra application having a git persistence layer, but I get an unpredicted application routing if this redirects (after edit action). I am unsure basically can deal with this by passing a startup choice to Sinatra, or by setting up within the virtual host declaration for that application a rewrite rule. Please inside your answer include which option you believe is better and a good example of how it may be accomplished. Thanks,

# apache virtualhost declaration
<VirtualHost *:80>
  ServerName wiki.domain.com
  DocumentRoot "/var/www/html"

  ProxyPass / http://localhost:3006
  ProxyPassReverse / http://localhost:3006
</VirtualHost>

resolves with sinatra acceptable for Will get, eg

wiki.domain.com/Home

but fails on sinatra redirect

# expected
wiki.domain.com/Home

# actual
wiki.domain.com:3006/Home

here is the Sinatra action (source: https://github.com/github/gollum/blob/master/lib/gollum/frontend/app.rb )

post '/edit/*' do
  name   = params[:splat].first
  wiki   = Gollum::Wiki.new(settings.gollum_path)
  page   = wiki.page(name)
  format = params[:format].intern
  name   = params[:rename] if params[:rename]

  wiki.update_page(page, name, format, params[:content], commit_message)

  redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
end

It’s a lengthy shot, but possibly the Web addresses within the ProxyPass directives must have a trailing /? That’s how it's within the documentation, and that i got a bit of strange records by mistake.record without one.