URL Map is not working with backend service on Load Balancer Google Cloud

1.6k views Asked by At

I am setting up URL Maps on our Backend Services with Load Balancer. The issue is that my URL Maps are not working for some reason. When I tried to browse domain.com/path, it shows

The requested URL /bpd was not found on this server.

I do believe I did the correct way, but seems that its still not working.

Please see screenshot below:

[![image][1]][1]

/* - working

/path1 and /path2 - not working, shows error - was not found on this server

app.yaml file:

runtime: python27
api_version: 1
threadsafe: true
service: 
handlers:
- url: /
  static_files: 
  upload: 
  secure: always
  redirect_http_response_code: 301

- url: /(.*)
  static_files: www/\1
  upload: www/(.*)

I also set-up Serverless network endpoint group and connected with Google App Engine for the Backend Services.

Thank you all for your help.

1

There are 1 answers

3
guillaume blaquiere On BEST ANSWER

Thanks to your comment, I though I found the mistake. In fact, when you define a URL map in a load balancer, the query path in entry of the load balancer is, by default, forwarded as-is to the backend.

Let's take your case

  • you have this URL map: <URL>/address/*. Your URL path is /address/*
  • The backend is <myAddressAppEngine.appspot.com>. It received the request on this path <myAddressAppEngine.appspot.com>/address/*

And it doesn't work because in reality you expect <myAddressAppEngine.appspot.com>/*.


To solve that, you can use advanced mode in the URL map

enter image description here

Start by setting the default backends for any URL and any path

enter image description here

Then add a new path rule and configure it like this, with a path rewrite to /

enter image description here