-
Notifications
You must be signed in to change notification settings - Fork 232
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
Unable to use proxyRequest in router eventHandler #257
Comments
Any advice on this please? I want to proxy all HTTP methods (GET, POST, PUT, DELETE) to a back-end server and can only proxy GET at the moment. Other methods are changed to GET requests plus any body payload is lost. |
Would you provide a reproduction in which vanilla h3 app without Nuxt is conneted to a publically accesible backend server, so that we could find where the root cause is: h3, Nuxt, or your own infra? By the way, as far as I tested instantly, h3's |
I don't think the issue is reproducible without Nuxt v3 in the equation. |
After much testing, I think the issue is to do with my local setup. Node fetch or H3 does not like that I am proxying the requests (for dev) to a local docker server which has a Lets Encrypt SSL. Even with |
I have been able to replace H3 with Express and it works, so I'll stick with that. |
Environment
Reproduction
Probably not a bug but a problem with my implementation, but help would be appreciated.
I am using h3 to create a proxy server - to send some /api requests to a back-end server. The API server is not publicly accessible.
I've created a router (
createRouter()
) and am adding routes viarouter.use()
It works fine but the body of a POST request is dropped. I've been using
sendProxy()
and saw thatproxyRequest()
is recommended to ensure headers and POST body are sent on to the back-end server.However, within the
eventHandler()
returning aproxyRequest()
results in none of my /api requests working.eg
Describe the bug
Replacing
sendProxy
withproxyRequest
results in a 404 error from the routerAdditional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: