8

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.

sowdri
  • 2,193
  • 5
  • 23
  • 36
  • I just tried in a web browser 35.186.214.135/ping/ and gave me an error as you said. 35.186.214.135/api/ping works. Did you follow the [Rewrite](https://cloud.google.com/load-balancing/docs/https/setting-up-url-rewrite) how-to guide? – Marcel P Jul 27 '20 at 22:58

2 Answers2

5

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.

Ieuan
  • 148
  • 2
  • 10
  • Hmmm, I'm serving my bucket from /files/public/ and I'm trying to rewrite so that I don't have to nest my files in the bucket under/files/public -- I've set the host prefix to just /* but hitting not-found, without the re-write, if I nest it in the appropriate folders, it works fine. – SebastianG Mar 17 '21 at 14:01
0

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