Forum: Ruby on Rails URLs in IIS - Please look at my code and offer suggestions!

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
on 2005-11-12 13:49
(Received via mailing list)
Many thanks to Florian F. for the code snippet for handling URL
writing.... It gave me an idea on how to solve my problem with IIS +
Subfolders / Apache + SCGI + subfolders

This is my first attempt at trying to override anything in Rails so
please be kind :)

Pick it apart though... Is this the right way to go about this code-wise
or is there something else I should be looking at, like maybe
AbstractRequest#relative_url_root() as was suggested on the dev site?
Should this be a plugin rather than doing what I'm doing?

If you need background information on this, see this posting

Enough boring-ness. Here's the code (again, borrowed much from Florian's
example).  I'm simply requiring this file from the production
environment.rb file. Everything "appears" to work as expected but I want
to see if anyone can see any potential problems.

# configure this for each application... Maybe this should go in
# environment.rb as well?
BASE_URL =  '/myvdirname'

module ActionController
   # Need this so stylesheets / JS files / images can be found
   ActionController::Base.asset_host = BASE_URL

   class UrlRewriter
     alias old_rewrite_url rewrite_url

     # url writing using the base dir specified above
     def rewrite_url(path, options)

       url = old_rewrite_url(path, options)

       # let's dump the protocol and the host if it's a local url....
       # This seemed necessary for redirect_to links.
       url = url.gsub(@request.protocol + @request.host_with_port, '')

	 #now let's add the base_url to the url.
       url = BASE_URL + url
       url  # return

Many thanks in advance to anyone who can help. We're closer than ever to
being able to use Rails in our production environment!

-Brian H.
This topic is locked and can not be replied to.