toomanyairmiles toomanyairmiles - 28 days ago 6
Apache Configuration Question

Speedy Https redirection

I'm presently using htaccess to force redirection to https for my website but I'm finding that redirected traffic is taking >1.5 seconds longer to receive the first file from the server than direct to https traffic.

What is the fastest way to force https for the whole site?

Answer

I believe that .htaccess is the fastest way to force https.

This is because .htaccess is a configuration on the web server (Apache), which is the first system to receive the http request.

Browser => DNS => Load Balancer => Web Server => Application

You could also force https at the application level but it would mean you have to go thru the server first. Unless you are using a load balancer, the web server is the first point contact a browser has with your https rules.

Of course, the fastest way would be to make sure all the links you are sending are in https so that the user never goes thru a redirect (301).