I’m running into a problem with redirect_to() and Apache’s
VirtualHost facility. I have probably have something set up
wrong, but I’m not even sure how to approach the problem.
Background:
We have DNS set up to return the domain’s address for all
sub-domains. So, “dig xyz.cfcl.com” returns the same IP
address as “dig cfcl.com”.
Our router forwards ranges of port numbers to specified
machines. So, a request on port 1234 might go to “fido”.
We are using Apache’s VirtualHost facility to redirect (?)
requests to certain machines, as:
<VirtualHost *:80>
ServerName xyz.cfcl.com
ServerAdmin [email protected]
ErrorLog /dev/null
CustomLog /dev/null common
ProxyRequests Off
ProxyPass / http://fido.cfcl.com:1234/
ProxyPassReverse / http://fido.cfcl.com:1234/
</VirtualHost>
As a result, requests to http://xyz.cfcl.com are answered
by a Rails server that is set up to answer port 1234 on
fido.cfcl.com. This (mostly) works fine, both inside and
outside of the LAN.
Problem:
If a user enters an invalid value into a form, we want to
set up the “flash” hash and redirect back to the page that
contained the form. Something like:
flash[:notice] = get_errors()
redirect_to(:back)
This works (on the LAN) when the URL of the form page is:
http://fido.cfcl.com:1234/conf/edit_new
However, if the URL is:
http://xyz.cfcl.com/conf/edit_new
the redirect results in:
Proxy Error
The proxy server received an invalid response from an
upstream server.
The proxy server could not handle the request POST
/conf/create.
Reason: Document contains no data
The server says:
[2007-06-21 14:18:42] ERROR URI::InvalidURIError:
the scheme http does not accept registry part:
xyz.cfcl.com (or bad hostname?)
/usr/local/lib/ruby/1.8/uri/generic.rb:729:in `merge'
...
Any ideas on what might be wrong or (better) how to fix it?
-r
http://www.cfcl.com/rdm Rich M.
http://www.cfcl.com/rdm/resume [email protected]
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development