Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6571391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:52:34+00:00 2026-05-25T14:52:34+00:00

I wonder if anyone got a jRuby Rails 3.0 app to work behind an

  • 0

I wonder if anyone got a jRuby Rails 3.0 app to work behind an Apache 2 proxy, through an AJP mount. I’d like the following configuration to work, without uncommenting the last statement.

<VirtualHost *:80>

  ServerName app.example.com

  ProxyRequests    Off
  ProxyPass        /    ajp://127.0.0.1:8009/app/
  ProxyPassReverse /    ajp://127.0.0.1:8009/app/

# ProxyPassReverse /    http://app.example.com/app/

</VirtualHost>

First, there seems to be no way to get relative redirects for named routes in the rails app (i.e. login and logout routes for restful_authentication). The Rails app does not even hook the reverse proxy statement on the AJP mount, but must be caught on a static HTTP reverse proxy rule for the full URI (shown in the comment). Second, there seems to be no proper way of suggesting assets output of HTML helpers on a level according to the reverse proxy rules.

I could do this, but it feels rather like an exploit, much like the static reverse proxy rule:

config.asset_path = proc { |path| path.gsub(/\/app\//, '/') }

Adding an RAILS_RELATIVE_URL_ROOT apparantly only adds to the already configured scope of the deployed warble WAR, and does not help reduce routes.

There must surely be mod_proxy_ajp solutions for running proxy and reverseproxy with unexact match routes.

Any ideas on how to solve this or point me in the direction of a resource covering the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:52:35+00:00Added an answer on May 25, 2026 at 2:52 pm

    Solution 1

    I think that if you need the HTTP rewrite magic you need to switch from using ajp and use the http proxying it fixes a couple of corner cases in proxying between different paths, it rewrites the http headers, I’m not sure proxy ajp does that. I’d just try to serve the rails app as ROOT.war or on a virtual host or something on the tomcat server to minimize the source of error proxying a folder as root. There’s always something that doesn’t work or needs adjustment. Ports and local domain names are cheap.

    Add this to your production environment config file:

    config.action_controller.relative_url_root = '/app'
    

    see more @ What is the replacement for ActionController::Base.relative_url_root?


    Solution 2:

    If you want to you can reset the incoming paths in the rails app with some easy rack middleware. This way the rails app would not know anything about not serving in the root path. You might also want to add config.serve_static_assets = true to make rails serve static assets in production mode.

    # application.rb
    require "proxy_path_reset_filter"
    config.middleware.use "ProxyPathResetFilter"
    config.action_controller.relative_url_root = '/'
    

    apologies for typing this freehand, but it should work.

     # proxy_path_reset_filter.rb
     class ProxyPathResetFilter
    
       def initialize(app)
         @app = app
       end
    
       def call(env)
         # some servers use REQUEST_URI and some use PATH_INFO for routing use both
         if (env['REQUEST_URI'] || env['PATH_INFO']) =~ /^\/app\//
           env.update({
              'REQUEST_URI' => env['REQUEST_URI'].gsub(/^\/app\//, '/')),
              'PATH_INFO'   => env['PATH_INFO'].gsub(/^\/app\//, '/')) })
         end
         @app.call(env)
       end
    
     end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder if anyone could suggest the best way of looping through all the
Wondering if anyone has a work around for this issue. I've got a markup
I've got a little history in CMS technology and I wonder if anyone could
Wonder if anyone can clear up the following for me. What happens if I
I wonder if anyone has seen this. I am developing a web app and
Wonder if anyone can help me understand how to sum up the column of
I wonder if anyone uses commercial/free java obfuscators on his own commercial product. I
I wonder if anyone here has any experience with mercurial running on Ubuntu? I've
I wonder if anyone can provide me with the regular expressions needed to parse
I wonder if anyone can help improve my understanding of JOINs in SQL. [If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.