Reputation: 2151
I was wondering if someone knows how to block the HTTP access to an external IP provided by Google's Load Balancer, so you can just access it using the domain name.
For example:
http://IP
-> Block the access or forward traffic to https://example.com
I know some providers offers "this" (like Cloudflare), but I am in Google Cloud, and the documentation hasn't helped me a lot.
Someone knows how to achieve this?, do I need an extra configuration/service?
Upvotes: 3
Views: 4097
Reputation: 2151
As John Hanley mentioned, you can achieve this by applying a cloud armor rule, checking the HTTP headers. Like this:
You must define the "greater" policy to deny all incoming request, and add a rule like the above to allow just the request with the corresponding Host (:authority for HTTP/2) header.
A note to consider is that this method does not work for backend buckets services (for now).
Upvotes: 9