Class: Skypager::Proxy::RequestProxy
- Inherits:
-
Rack::Proxy
- Object
- Rack::Proxy
- Skypager::Proxy::RequestProxy
- Defined in:
- lib/skypager/proxy.rb
Instance Method Summary collapse
Instance Method Details
#cfg ⇒ Object
180 181 182 |
# File 'lib/skypager/proxy.rb', line 180 def cfg @cfg ||= {} end |
#rewrite_env(e) ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/skypager/proxy.rb', line 184 def rewrite_env(e) e.tap do |env| current = env['HTTP_HOST'] current_host, current_port = current.split(':') host = cfg[:host].to_s host = host + ":#{ cfg[:port] }" if cfg[:port] Rails.logger.info "replacing #{ current } with #{ host } #{ env['PATH_INFO'] }" env['HTTP_HOST'] = host end end |
#set_config(options = {}) ⇒ Object
175 176 177 178 |
# File 'lib/skypager/proxy.rb', line 175 def set_config ={} cfg.merge!() cfg end |