Hogan, Brian P.
2005-Nov-10 21:33 UTC
URLs in IIS - Please look at my code and offer suggestions!
Many thanks to Florian Frank 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
http://dev.rubyonrails.com/ticket/2602
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.
vender/vdir_fix.rb
====================# 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
end
end
end
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 Hogan
Hogan, Brian P.
2005-Nov-11 21:13 UTC
RE: URLs in IIS - Please look at my code and offer suggestions!
Bump....
Anyone?? Anyone?? Otherwise I''ll just assume that this is appropriate.
-----Original Message-----
From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On
Behalf Of Hogan, Brian
P.
Sent: Thursday, November 10, 2005 3:33 PM
To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: [Rails] URLs in IIS - Please look at my code and offer
suggestions!
Many thanks to Florian Frank 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
http://dev.rubyonrails.com/ticket/2602
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.
vender/vdir_fix.rb
====================# 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
end
end
end
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 Hogan
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails
Jeremy Kemper
2005-Nov-11 21:23 UTC
Re: URLs in IIS - Please look at my code and offer suggestions!
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Nov 11, 2005, at 1:13 PM, Hogan, Brian P. wrote:> Bump.... > > Anyone?? Anyone?? Otherwise I''ll just assume that this is appropriate.Brian, I don''t think anyone understands what the problem is. Could you motivate your solution with a discussion of the problem? I don''t know why IIS and SCGI have this need. Best, jeremy> -----Original Message----- > From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Hogan, Brian > P. > Sent: Thursday, November 10, 2005 3:33 PM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails] URLs in IIS - Please look at my code and offer > suggestions! > > > Many thanks to Florian Frank 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 > > http://dev.rubyonrails.com/ticket/2602 > > 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. > > vender/vdir_fix.rb > ====================> # 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 > end > end > end > > 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 Hogan > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFDdQu3AQHALep9HFYRAgLGAJ9RgI08MLhY4U+T3SDzvsZmy7BJoQCdHG+I +3gv5OjjdhmmiUE7yhZPlcU=asyg -----END PGP SIGNATURE-----