Add header when proxing

Discussion in 'Ruby/Rails' started by zhesto, Jun 20, 2006.

  1. zhesto

    zhesto New Member

    Hi,
    I'm using litespeed-2.1.16 to proxy requests to backend web server (Ruby on Rails with Mongrel). When using HTTPS I need to add a special header to the request, so the backend server will understand that the initial request is over HTTPS. For example with pound reverse proxy (see http://mongrel.rubyforge.org/docs/pound.html ):
    Code:
    AddHeader "X-Forwarded-Proto: https"
    
    For Apache:
    Code:
    RequestHeader set X_FORWARDED_PROTO 'https'
    
    How to add such a header with LiteSpeed?
  2. mistwang

    mistwang LiteSpeed Staff

    That header will be added automatically by LSWS 2.1.17. The new release will be announced soon. Actaully, you can downalod it now.
  3. zhesto

    zhesto New Member

    Thank you very much. You made my day :) Just for the record (maybe can help somebody) - what I'm doing in the moment:
    Code:
    # app/controller/application.rb
    def require_ssl
      env['HTTPS'] = 'on' unless (@request.ssl? or local_request?)
    end
    
    # app/controller/othercontroller.rb
    before_filter :require_ssl
    # or: before_filter :require_ssl, :only => [:some_action]
    # or: before_filter :require_ssl, :except => [:some_action]
    

Share This Page