Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not honor RAIL_RELATIVE_URL_ROOT for Passenger based deployments #11

Open
kodbale opened this issue May 27, 2011 · 4 comments
Open

Comments

@kodbale
Copy link

kodbale commented May 27, 2011

Hi,

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.

http://myhost.com/mygroup/myapp/

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

"http://myhost.com/images/tiny_mce/spinner.gif" 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:

"http://myhost.com/mygroup/myapp/images/tiny_mce/spinner.gif"

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?

@sandipransing
Copy link
Owner

Can you change related urls to get it work with your app if that works let
me know so that i can do configurable change.

On Fri, May 27, 2011 at 10:16 PM, kodbale <
[email protected]>wrote:

Hi,

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.

http://myhost.com/mygroup/myapp/

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

"http://myhost.com/images/tiny_mce/spinner.gif" 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:

"http://myhost.com/mygroup/myapp/images/tiny_mce/spinner.gif"

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?

Reply to this email directly or view it on GitHub:
#11

sαη∂ιρ Rαηѕιηg


JOsh SOftware PVt. LTd.

web www.joshsoftware.com
blog www.funonrails.com
twitter @sandipransing
skype sandip.ransing

@kodbale
Copy link
Author

kodbale commented May 31, 2011

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!

@sandipransing
Copy link
Owner

Cool..Sounds great !!

But As per my consideration all the urls needs to loaded through yml file so
that urls can be easily configurable for more generalized usage. What say ??

Thanks!
On Tue, May 31, 2011 at 8:06 PM, kodbale <
[email protected]>wrote:

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!

Reply to this email directly or view it on GitHub:
#11 (comment)

sαη∂ιρ Rαηѕιηg


JOsh SOftware PVt. LTd.

web www.joshsoftware.com
blog www.funonrails.com
twitter @sandipransing
skype sandip.ransing

@kodbale
Copy link
Author

kodbale commented May 31, 2011

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants