As far as I know roughly three approaches are possible.
Don't do any URL remapping at the level of Apache, place all such logic on the F5. The F5 is aware of the original protocol and will generate correct HTTP(S) URL's.
Because you're doing SSL off-loading your actual web server is not aware if the original request was made over HTTPS or plain HTTP. You can make Apache (and all your other applications) aware of the original protocol the client used by injecting the X-Forwarded-Proto
header on the F5.
You can then make protocol aware redirects:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} https [NC]
RewriteRule ^(/?)$ https://%{HTTP_HOST}%/fr.html [R=301,L]
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^(/?)$ /fr.html [R=301,L]
- Leverage an iRule for the HTTPS virtual server that rewrites any occurrence of absolute URL's
http://www.example.com
to https://www.example.com
.
That has the additional benefit of also preventing "insecure content" warnings when your web sites and web applications contain other absolute references to http://www.example.com
for stylesheets, images, links and other content.
STREAM::expression { @http://<www.example.com>@https://<www.example.com>@ }
Edit: a fourth option is of course to not send a HTTP Redirect to the client, but simply substitute the URL internally in Apache, in other words, loose the R
flag...