Does not honor RAIL_RELATIVE_URL_ROOT for Passenger based deployments #11

kodbale opened this Issue May 27, 2011 · 4 comments

2 participants



I am having issues in getting the plugin image/upload mechanism to work properly when deployed under passenger to shared environment. My application is hosted in an environment shared by multiple applications.

The TinyMCE installation uses hardcoded paths to images such as:
"/images/tiny_mce/spinner.gif" which will look for the file at:

"" which makes it an invalid link.

The Passenger installation passes an environment variable called RAILS_RELATIVE_URL_ROOT which could be used in such cases to link to the right image at:


I have tried using the :relative_url and :document_base_url settings but could not get either to work properly.
I am either missing something fundamental / doing something stupid but otherwise have not been able to get the plugin file upload to work.

Any suggestions?


Firstly, thanks for responding. Your plugin did save me a lot of time and I am thankful to you for sharing it and maintaining it.

Given a project time crunch, I did get it to work on my installation by just hardcoding the paths. Unfortunately that is not a very portable or elegant change - I had to make approximately 10-20 edits in the HTML/JS code to get it to nominally work on my installation, but since all the locations were easily "grep"able, it was not really that bad.

Using the ActionView helpers such as image_tag would be ideal but since the file upload dialog is static HTML, there was little I could see as a quick fix hence I adopted the hard-coded path hack!


Sure, it would certainly help to have a configuration setting.

But on the other hand, why use a configuration setting when the configuration is already available as an environment variable. It leaves one less thing to worry about right? One can check if RAILS_RELATIVE_URL_ROOT is defined, use it if it is and ignore it if it not defined.

Another idea is to use the value defined in "config.action_controller.relative_url_root" thereby pushing up the responsibility for setting the URL to application layer instead of the plugin. I wonder if that would work? Either way, it still means that the HTML/JS needs to be tweaked to use ERB (and RJS?). That is what I would be concerned above all else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment