Alejandro Barone
Alejandro Barone

Reputation: 2151

Block direct external IP access for GCP's HTTP Load Balancer

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:

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

Answers (1)

Alejandro Barone
Alejandro Barone

Reputation: 2151

As John Hanley mentioned, you can achieve this by applying a cloud armor rule, checking the HTTP headers. Like this:

enter image description here

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

Related Questions