Follow-up to Lighttpd Proxy

December 29th, 2005

So. My problem with Lighttpd’s mod_proxy turned out to be in Rails’ url_for and redirect_to methods. Whenever my application would call redirect_to (I have a lot of redirects that happen after submitting a form) the redirect_to method would dutifully append the application’s current port to the URL. In my case the URL would go from http://mysite.crossconnector.com/mywebpage to http://mysite.crossconnector.com:8080/mywebpage. Not what I wanted.

The solution is incredibly simple. But what did you expect? It’s rails.

I opened my ApplicationController and added the following code:

  protected
  def default_url_options(options)
    { :host => @request.host }
  end

That’s it! Now all requests will automatically be routed to port 80.


Sorry, comments are closed for this article.