2

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.

Charles
  • 21
  • 2

1 Answers1

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

JMS
  • 111
  • 3