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

Receiving 404 - Resource Not Found after rewriting req$PATH_INFO in filter #877

Open
tonyfalc opened this issue Aug 25, 2022 · 1 comment

Comments

@tonyfalc
Copy link

I have created a filter that parses req$postBody and rewrites req$PATH_INFO based on the value of one of its fields. For example, if I were to POST JSON containing

{ "tag" : "foo" }

to endpoint "/bar", at the conclusion of the filter, req$PATH_INFO is changed from "/bar" to "/foo/bar"; however, even though I have attached functions to both endpoints "/bar" and "/foo/bar" neither one of these is invoked: I simply receive a "404 - Resource Not Found." My understanding/expectation is that "plumber::forward()" would route the request based on the value of req$PATH_INFO, and the question was whether this routing was determined either before or after the filter was applied: if before, I would see the output of the function attached to "/bar" and if after, that associated with "/foo/bar." The fact that I get neither seems strange.

@schloerke
Copy link
Collaborator

I can see that req$PATH_INFO is being read after the filters is being executed. I don't readily see how the bug is occurring.

Can you please supply a reprex API? Thank you!


PR made so that mounted endpoints also listen to the latest value of req$PATH_INFO

@thomasp85 thomasp85 reopened this Jan 24, 2025
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

No branches or pull requests

3 participants