Help please with an LB&SSL configuration for a Rails APP
Hi,
I need to set up an iRule with an SSL certificate which connects the 443 port to the 80 of the backend servers (the communication between the balancer and backends are in plain http). Problem is that my app is a Ruby on Rails app which needs to detect that the origin request was done in HTTPS to properly redirect and provide https urls.
The framework can read the following headers: (rails request.rb code snippet)
def scheme
if @env['HTTPS'] == 'on'
'https'
elsif @env['HTTP_X_FORWARDED_SSL'] == 'on'
'https'
elsif @env['HTTP_X_FORWARDED_SCHEME']
@env['HTTP_X_FORWARDED_SCHEME']
elsif @env['HTTP_X_FORWARDED_PROTO']
@env['HTTP_X_FORWARDED_PROTO'].split(',')[0]
else
@env["rack.url_scheme"]
end
end
How can i inject one of those headers? (ie: HTTP_X_FORWARDED_SCHEME=https) or should the iRule do this automatically for me when configuring certificates on it?
PS: Sorry about my iRule's technical level. I'm the developer behind the F5 balancer needing this simple header so my app can redirect properly to https urls :(
Thanks!
Antonio