GoogleCloudPlatform / GoogleCloudPlatform/esp-v2

Requests are not forwarded to the target if "address" URL includes a resource path

Open
#922 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
307
Forks
185
Avg merge
14h 45m
Merged PRs (30d)
6

Description

When `path_translation: CONSTANT_ADDRESS` is used at the endpoint level and the `address` includes a resource path the ESP does not forward the request to the target backend address.

With the below configuration the requests are forwarded (the target backend returns 404 because there is nothing at root path):

```
/ourendpoint/healthz:
get:
summary: health check
operationId: ourEndpointhHealthz
x-google-backend:
address: https://ourendpoint-2jxxxxdi7a-lm.a.run.app
path_translation: CONSTANT_ADDRESS
protocol: h2
security: []
responses:
"200":
description: success
```

Screenshot below shows the GCP logs. The behavior is as expected

![image](https://github.com/user-attachments/assets/15702f4d-5193-40b1-9a7b-12744869189e)

With the below configuration the Cloud Endpoint / ESP simply returns a 404 and does not attempt to forward to the target

```
/ourendpoint/healthz:
get:
summary: health check
operationId: ourEndpointhHealthz
x-google-backend:
address: https://ourendpoint-2jxxxxdi7a-lm.a.run.app/healthz
path_translation: CONSTANT_ADDRESS
protocol: h2
security: []
responses:
"200":
description: success
```

Screenshot below shows the GCP logs.

![image](https://github.com/user-attachments/assets/70d06224-fcb4-41d2-84c6-cbcd2b88d534)

# Expected behavior:
ESP forwards the request to `address: https://ourendpoint-2jxxxxdi7a-lm.a.run.app/healthz` when
`path_translation: CONSTANT_ADDRESS` is set

This is how it should work according to documentation https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#understanding_path_translation

# Actual behavior

ESP returns a 404 and does not attempt to forward the request to the target backend when target address included a resource

Tested with 2.47.0 and 2.50.0

Please advise if this is a bug or me doing something wrong

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two OpenAPI configurations using `path_translation: CONSTANT_ADDRESS`, comparing an address with and without the `/healthz` resource path and checking the target logs. The fix is complete when ESP forwards the request to the resource path instead of returning 404; the issue names no source files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, go, google-cloud, openapi
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.