I've currently got a website hosted on Google Compute Engine that's authenticated with Identity-Aware-Proxy which sits behind a load balancer. This all works great over https, but I was wanting to make sure that http redirects to https as it currently just responds with a 404.
So, I followed https://cloud.google.com/load-balancing/docs/https/setting-up-http-https-redirect which tells you to set up a second load balancer to redirect http traffic to https.
The issue is however, that after following these instructions, when I browse to http://my-website.com I get the following error:
Error 403 (Forbidden)!!1
- That’s an error.
Your client does not have permission to get URL / from this server. That’s all we know.
Although the http load balancer is set up with a 301 - Moved Permanently Full path Redirect, in the browser developer tools network tab there is no redirect which happens. It just responds straight away with the 403. The URL also stays with the http:// scheme.
To summarise, here's what my setup looks like:
External HTTPS Load Balancer
- Frontend - HTTPS, static IP, HTTPS only
- Backend - Identity-Aware-Proxy (email authentication via Identity Platform) -> Compute Engine instance group
External HTTP Load Balancer
- Frontend - HTTP, static IP (Same as HTTPS Load Balancer above)
- Backend - None
- Host and Path Rules:
- Mode: Advanced host and path rule (URL redirect, URL rewrite)
- Action: Redirect the client to different host/path
- Host redirect: https://my-website.com
- Path value: *
- Redirect response code: 301 - Moved Permanently
- HTTPS redirect: Enabled
Any ideas how to fix this, and not get the 403 would be much appreciated!