Skip to content

Request path includes API gateway stage twice #668

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

Closed
dcchut opened this issue Jun 28, 2023 · 3 comments · Fixed by #669
Closed

Request path includes API gateway stage twice #668

dcchut opened this issue Jun 28, 2023 · 3 comments · Fixed by #669

Comments

@dcchut
Copy link

dcchut commented Jun 28, 2023

Background

I have an API gateway hooked up to a lambda - I don't have any parameter mappings & I'm not using a custom domain. The lambda uses lambda_http together with axum. The API gateway has a stage called Prod, the invoke URL is along the lines of:

https://blablabla.execute-api.ap-southeast-2.amazonaws.com/Prod

Current outcome

When performing a request such as POST https://blablabla.execute-api.ap-southeast-2.amazonaws.com/Prod/auth/login,
lambda_http rewrites the request path to /Prod/Prod/auth/login.

Expected outcome

I would expect the request path to be /Prod/auth/login.

Other information

While there is a workaround (rewrite the path in middleware), the underlying behavior of including the stage twice is very surprising to me - is is possible I've misconfigured something?

Related discussion in #107 and #450.

@dcchut dcchut changed the title HTTP Request path from API gateway includes stage twice Request path from API gateway includes stage twice Jun 28, 2023
@dcchut dcchut changed the title Request path from API gateway includes stage twice Request path includes API gateway stage twice Jun 28, 2023
@calavera
Copy link
Contributor

Are you using APIGW Rest or HTTP? I wonder if APIGW started sending the stage in the path.

Can you print the content of req.raw_http_path()? That should not have the stage part. If it does, the event's data has changed.

@dcchut
Copy link
Author

dcchut commented Jun 28, 2023

HTTP. req.raw_http_path() is /Prod/auth/login.

@github-actions
Copy link

github-actions bot commented Jul 2, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for the maintainers of this repository to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants