Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We deployed a Rails application on a backend server, served via Passenger. This application is served at port 9000, and is configured to use sub_uri. Originally the URL is http://ip.address:9000/, and now it is served at http://ip.address:9000/app1. All CSS, javascript, images files are loaded, and there is no error in the application.

Now we need to integrate this application into our production environment. The backend server above won't be accessible directly; all applications are to be proxy'ed via Apache on a front end server. Using ReverseProxy and Proxy, this Rails application should be accessible via http ://domain.name/app1.

The current apache configuration we are using for PHP applications, in-house apps are:

ProxyPassReverse /app1 http ://ip.address:9000/app1
ProxyPass /app1 http ://ip.address:9000/app1 retry=5

The application kinda loaded, but there are 2 problems:

  1. all static files (javascript, images, and CSS) are missing. The apache looks for it in its own directory, not at the server hosting the Rails application.
  2. some other functions are broken.

I don't know what is the best way to configure this setup. Work on the front end or do more configuration on the backend? Should I remove sub_uri and do all configuration in the frontend server? I'm currently using RailsBaseURI on the Rails server. After reading this site there are other options such as PassengerEnabled, PassengerAppRoot.

What should I do? I'm very new to Ruby, Rails and Passenger, and any help are much appreciated.

share|improve this question

1 Answer 1

You need to add the following to your config/production.rb file, assuming this is relevant to your production environment.

config.action_controller.relative_url_root = '/app1'

This is taken from the Rails ticket #1946

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.