Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service invocation via request header removes trailing slash #7686

Open
koell-casa opened this issue Apr 10, 2024 · 2 comments
Open

Service invocation via request header removes trailing slash #7686

koell-casa opened this issue Apr 10, 2024 · 2 comments
Labels
good first issue Good for newcomers kind/bug Something isn't working
Milestone

Comments

@koell-casa
Copy link

Hi,

this week we tried to implement a Non-Dapr endpoint via HTTP. Normally we use the dapr-app-id in the header instead of the /v1.0/invoke/{appId}/method/{methodName}, but ran into an issue with one of our endpoints. For this endpoint we need to have a trailing slash, which doesn't arrive at our server. Strangely enough, the dapr logs show the trailing slash. Calling the endpoint with the /v1.0/invoke/{appId}/method/{methodName}/ version works. So my guess is, that it has something to to with the dapr-app-id header version. (Maybe the log is not correct?)

In what area(s)?

/area runtime

What version of Dapr?

1.13.0

Expected Behavior

URL should be send to the endpoint as specified.

Actual Behavior

Trailing slash is missing.

Steps to Reproduce the Problem

Dapr Kubernetes Sidecar
Calling the HTTPEndpoint via /v1.0/invoke/{appId}/method/{methodName}/ (including trailing slash), the server returns 200.

Dapr Log

time="2024-04-10T13:47:41.873135982Z" level=info msg="HTTP API Called" app_id=xy code=200 duration=1159 instance=xy-6d5bb584b-s4trc method="GET /v1.0/invoke/appId/method/my-demo/route/2024-04-08T00:00:00.0000000/2024-04-08T23:59:59.9990000/" scope=dapr.runtime.http-info size=4994 type=log ver=1.13.0

Server Log

2024-04-10 13:47:41 10.21.1.10 GET /my-demo/route/2024-04-08T00:00:00.0000000/2024-04-08T23:59:59.9990000/ - 443 - 127.0.0.1 Go-http-client/2.0 - 200 0 0 1065 400 6610 800d

Calling the HTTPEndpoint via /{methodName}/ and dapr-app-id header, the server returns 404 (as the trailing slash is missing)

Dapr Log

time="2024-04-10T13:50:03.933427538Z" level=info msg="HTTP API Called" app_id=xy code=404 duration=11 instance=xy-6d5bb584b-s4trc method="GET /my-demo/route/2024-04-08T00:00:00.0000000/2024-04-08T23:59:59.9990000/" scope=dapr.runtime.http-info size=5848 type=log ver=1.13.0

Server Log

2024-04-10 13:50:03 10.21.1.10 GET /my-demo/route/2024-04-08T00:00:00.0000000/2024-04-08T23:59:59.9990000 - 443 - 127.0.0.1 Go-http-client/2.0 - 404 0 2 10 400 6610 800d

Release Note

RELEASE NOTE:

@koell-casa koell-casa added the kind/bug Something isn't working label Apr 10, 2024
@yaron2 yaron2 added this to the v1.14 milestone Apr 12, 2024
@yaron2 yaron2 added the good first issue Good for newcomers label Apr 12, 2024
@yaron2
Copy link
Member

yaron2 commented Apr 12, 2024

Interesting find, will look into this.

@ckcd
Copy link
Contributor

ckcd commented Apr 19, 2024

@yaron2 This may be because path.Clean will simplify the path.
https://github.com/dapr/dapr/blob/master/pkg/api/http/directmessaging.go#L300

In path.Clean's comments it said:

// The returned path ends in a slash only if it is the root "/".

But I'm wondering should we change this behavior? since path.Clean may be standard solution, is trailing slash reasonable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/bug Something isn't working
Projects
Status: Needs Owner
Development

No branches or pull requests

3 participants