About redirecting HTTP to HTTPS with GCP Load Balancer

1,768 views
Skip to first unread message

Phuong

unread,
Aug 7, 2018, 3:39:15 AM8/7/18
to gce-discussion
Hello,

I'm a newbie to GCP world.
I have a system consists of two instances which run Apache Tomcat, 1 HTTP(s) Load Balancer.
On the Apache Tomcat, I've configured to always redirect HTTP request to become HTTPS requests. I've verified that the redirection works well if I point a domain to each instance.
Then, I put the two instances into one Load Balancer, try to configure everything as document said to redirect HTTP to HTTPS.
The result is that when I input an HTTP query like http://abc.com is not redirected to https://abc.com
I've tried to search throughout the Internet but there is still no success.

Please give me some suggestions about this situation, maybe the way I can debug it, which document I should research.
Thanks in advance!

Ishtiaque

unread,
Aug 7, 2018, 11:22:35 AM8/7/18
to gce-discussion
Hello Phuong,

Currently, Google HTTP(S) Load Balancing does not support traffic re-direction from HTTP to HTTPS. However, we do have a feature request (FR) to address this issue but I cannot provide an ETA on the implementation of this feature. I would suggest that you keep track of the issue on PIT link in order to get more updates and to know when this feature will be GA.

In the meantime, as a workaround you may try the following sample mod rewrite setup:

# allow for healthcheck to occur 
RewriteCond %{REQUEST_URI} !^/healthcheck.html 
# redirect http to https 
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR] 
# redirect www to non www (if you want) 
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

You can also check this information in the above PIT link in comment#16 and comment#18. I would highly recommend to participate in the discussion in this public request thread.

I hope this helps. 

Phuong

unread,
Aug 7, 2018, 10:18:53 PM8/7/18
to gce-discussion
Thanks for your answer.
This is a quite simple feature, I don't know why GCP doesn't support it.
Reply all
Reply to author
Forward
0 new messages