I have a HTTP and HTTPS load balancer on Goole Cloud. Is it possible to set it up to enforce (redirect) all connections to HTTPS?
Not at the load balancer as of June 2015.
As an alternative, you can configure your web servers to return 301 for all HTTP requests redirecting to the HTTPS version.
For Apache (from https://wiki.apache.org/httpd/RedirectSSL):
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent / https://www.example.com/
</VirtualHost>
<VirtualHost _default_:443>
ServerName www.example.com
DocumentRoot /my/document/root
SSLEngine On
# .. etc .
</VirtualHost>
For nginx (from https://serverfault.com/questions/67316/in-nginx-how-can-i-rewrite-all-http-requests-to-https-while-maintaining-sub-dom):
server {
listen [::]:80;
return 301 https://$host$request_uri;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With