Forum: Ruby on Rails default_url_options for relative tag URLs

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-01-17 02:27
(Received via mailing list)
Hello,

I need help with using 'default_url_options'. At least this is the
function that I *think* is involved in the solution I seek. :)

I'm deploying my rails app beneath an Apache ProxyPass setup. I've got
it all working fine except that any rails tagging functions in my
templates create absolute URL references.

For example, this stylesheet function in my layout:

 <%= stylesheet_link_tag 'mystyle' %>

Creates HTML like:

 <link href="/stylesheets/mystyle.css" ....>

Referencing from the document root breaks my ProxyPass environment.

Of course I could just add /stylesheets/ and /javascripts/ and /images/
to my Apache ProxyPass config. But that doesn't seem like the correct
solution.

Isn't there some way within the rails framework to set all URLs to be
relative?

I've tried setting ':only_path = false' in my controller/application.rb
def of defaults_url_options. But it doesn't help.

Does anybody know how to solve this problem?

Thank you!

   Matt

--
Matt C. Wagner
Information Security Analyst

Network Intrusion Detection
Security Operations Center
Corporate Information Security
Wells Fargo Bank
Ben M. (Guest)
on 2006-01-17 02:27
(Received via mailing list)
There's probably some spiffy rails way of doing this, but I'm still a
newbie so I don't
know what it is. However, you could probably make this work just using
the html base tag:

http://www.w3schools.com/tags/tag_base.asp

Set the base tag in your layout.rhtml and all the urls on all pages that
use that layout
(the whole app?) will get that base url appended to them by the browser.

b
This topic is locked and can not be replied to.