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

  • SEARCH
  • Home
  • 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 909071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:49:02+00:00 2026-05-15T16:49:02+00:00

My setup: thin running on port 1234 with –prefix /foobar apache running on port

  • 0

My setup:
thin running on port 1234 with --prefix /foobar
apache running on port 80
apache reverse proxies /foobar to thin on port 1234

I would like the static assets to not be served via the proxy to thin, but instead be served at /assets directly via apache instead.

I have to use a relative path because I don’t know the host name/ip of the rails application before startup (it’s app-in-a-box that should be able to be moved around).

I found config.action_controller.asset_host in production.rb, but I can’t set that to a relative path. When I do it gets confused and creates really bogus URLs.

How can I make this work?

  • 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-15T16:49:03+00:00Added an answer on May 15, 2026 at 4:49 pm

    First, I want to thank Geoff and darkliquid. I took what was in darkliquid’s link and worked on it to make it work for my case. The big challenge was that I wasn’t serving the rails application from the root of the webserver.

    Notes:

    • thin is run with --prefix '/railsapp' on port 9999.
    • This works for windows and linux. W00T!
    • I have to use the LA-U (look-ahead) to get the final filename apache would use.
    • The IS_SUBREQ check is to prevent the look-ahead (a sub request) from ever returning the proxy.
    • The /railsapp/index.html rewrite is required because otherwise another rule in my apache conf would rewrite it to /index.html, which is a default ‘here’s what’s here’ page; 404s are served elsewhere, though.

    Here’s the relevant part of the apache configuration:

    # Only proxy the thin stuff.
    <Proxy /railsapp/*>
        Order deny,allow
        Allow from all
    </Proxy>
    
    ## Add an alias for filename mapping.
    Alias /railsapp "/website/root/railsapp/public"
    
    ## We need the Rewrite Engine for this.
    RewriteEngine on
    <IfDefine debug>
        ## If debugging, turn on logging.
        RewriteLogLevel 9
        RewriteLog "/website/logs/http.rewrite.log"
    </IfDefine>
    
    ## Check for a static root page.
    RewriteRule ^/railsapp/?$ /railsapp/index.html [QSA]
    
    ## Check for Rails caching.
    RewriteRule ^(/railsapp/[^.]+)$ $1.html [QSA]
    
    ## Redirect all non-static requests to Rails.
    # Don't proxy on sub-requests (needed to make the LA-U work).
    RewriteCond %{IS_SUBREQ} false
    # Use look-ahead to see if the filename exists after all the rewrites.
    RewriteCond %{LA-U:REQUEST_FILENAME} !-f
    # Proxy it to Rails.
    RewriteRule ^/railsapp(.*)$  http://127.0.0.1:9999%{REQUEST_URI} [P,QSA,L]
    
    ## Make sure Rails requests are reversed correctly.
    ProxyPassReverse /railsapp http://127.0.0.1:9999/railsapp
    
    ## Disable keepalive; railsappd doesn't support them.
    SetEnv proxy-nokeepalive 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I setup phpMyID on one of my machines, and I'm trying to get apache
Our setup is standard nginx (ver 0.7.59) + thin upstream servers on Debian lenny.
The setup is like this: Col1 Col2 12345 12 12348 14 20145 16 00541
I setup a class with: class Example { static const float array[3][8]; }; and
Setup Have you ever had the experience of going into a piece of code
Setup I have a website that draws RSS feeds and displays them on the
Setup is following: Drupal project, one svn repo with trunk/qa/production-ready branches, vhosts for every
Setup is SQL2005 SP2 with Reporting Services installed local on Win2003 64bit. When users
Setup: I have an HTML page with a fieldset element. The background color of
Setup I have a VBScript for driving the stress testing of a web service.

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.