Defect #2508

Do not use absolute URL !

Added by Martin Letendre over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:2009-01-14
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution: Affected version:

Description

Everywhere in the application you should use relative URL instead of absolute URL. For example in the login page you have this reference to a javascript file(this URL is absolute! ):

<script src="/javascripts/main.js?1215344801" type="text/javascript"></script>

You should have this reference instead:

<script src="javascripts/main.js?1215344801" type="text/javascript"></script>

This is really important if you use redmine in a corporate environment where there is often a web server configure in a reverse proxy mode (example: apache httpd) in front of the web application (ex: redmine).

PS: Reverse Proxy http://en.wikipedia.org/wiki/Reverse_proxy


I found this issue while installing apache httpd behind redmine in an enterprise context. Here is my apache httpd configuration.

ProxyPass /redmine https://redmine-host:3000/
ProxyPassReverse /redmine https://redmine-host:3000/

This configuration means: if you receive a query at https://apache-httpd-web-server-host/redmine than redirect the request to http://redmine-host:3000/

The problem with using absolute URL is that you break this process.

-------------------------------------------------------------------
For example the link to your JavaScript file should be (with relative URL):

https://apache-httpd-web-server-host/redmine/javascripts/main.js?1215344801

Because you’re using absolute URL it search for an unexisting resource

https://apache-httpd-web-server-host/javascripts/main.js?1215344801


In conclusion:

Absolute URL is like Crossing the Streams ... http://www.youtube.com/watch?v=8jJ2WnRjzWs

History

#1 Updated by Martin Letendre over 9 years ago

PS: Your product stand out of the crowd. I hope my compagny will be able to buy the support soon.

#2 Updated by Jean-Baptiste Barth over 9 years ago

I disagree, there's no real problem with that imho.

The problem you describe does not seem to be about using reverse proxying. Your problem is about using Redmine in a subdirectory ("/redmine/" in your case). It has been discussed here and here, you should read this articles first.

It's really easy with Mongrel and its "--prefix" option, but if you don't use Mongrel I strongly advice you change the URL from "www.yoursite.com/redmine/" to a subdomain with an apache virtual host, maybe "redmine.yoursite.com" or something like this.

#3 Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from New to Closed
  • Affected version (unused) deleted (0.8.0)

Another solution: add the following line at the end of config/environment.rb:

ActionController::AbstractRequest.relative_url_root = "/redmine"

All links will be prefixed with "/redmine" which is what you need.

#4 Updated by Jean-Baptiste Barth over 9 years ago

I missed that.. The article I pointed out is clearly outdated with this directive.

Also available in: Atom PDF