sowdri
sowdri

Reputation: 2243

Google Cloud Load balancer URL Rewrite not working

I'm trying to setup google cloud load-balancer with HTTPS proxy. The rewrite rules doesn't seem to work. I've attached a screenshot of the same. Any help is appreciated.

enter image description here

Basically I'm trying to access <domain>/api/ping on <domain>/ping. Not sure what the Host rewrite is about as well.

Thanks in advance.

Upvotes: 8

Views: 7264

Answers (3)

Mauricio
Mauricio

Reputation: 3079

I've found the solution for this. To avoid having Not Found message for static content, you need to update your bucket with gsutil web set to set the error_page parameter (-e) as your index.html:

gsutil web set -m index.html -e index.html gs://<bucket-name>

Found this here: https://serverfault.com/a/1045214/172334

Upvotes: 0

Yılmaz ŞEN
Yılmaz ŞEN

Reputation: 37

You should change your path prefix rewrite from "/API/ping" to "/". It will be work If you use a bucket.

Upvotes: -2

Ieuan
Ieuan

Reputation: 148

I think the problem is that (at the moment) GCP Load Balancers rewrite is only a "path prefix" rewrite, not a full rewrite, i.e. it prepends the value of the "path prefix rewrite" onto the original request URL.

So I suspect what you have currently is resulting in a request to restoplus-api-backend-services with a URL of /api/ping/ping.

If you set the value of "path prefix rewrite" to /api, you should get a request to your backend of /api/ping.

Upvotes: 5

Related Questions