You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the newly created API route, like GET localhost:3000/api/users/, and observe that in the receiving end (backend) the Host header is not replaced by the correct value.
Describe the bug
When using the proxyRequest function in the latest Nuxt JS version, the Host header is ignored. From looking into the Github issues, a similar problem was found, as seen here: #709 (in this case, the Accept header is ignored), introduced by this PR: #646.
In the case of my project, we use the Host header to change the tenant domain on the backend side (one subdomain per tenant).
Same here. We run 1 nuxt instance serving 4 sites, each running their own APIs. Our problem is even using useRequestFetch the host isn't set because of this same line of code.
Being able to unIgnore headers would be great (and being able to pass that list to useRequestFetch).
Currently our APIS are https://[domain]/api/[domain]/foo/ which is pretty gross.
Environment
Reproduction
nuxt.config.ts
:server/api/[...].ts
GET localhost:3000/api/users/
, and observe that in the receiving end (backend) theHost
header is not replaced by the correct value.Describe the bug
When using the
proxyRequest
function in the latest Nuxt JS version, theHost
header is ignored. From looking into the Github issues, a similar problem was found, as seen here: #709 (in this case, theAccept
header is ignored), introduced by this PR: #646.In the case of my project, we use the
Host
header to change the tenant domain on the backend side (one subdomain per tenant).A culript piece of code was found here:
h3/src/utils/proxy.ts
Lines 25 to 33 in 17fc905
where the
Host
header and others are explicitly being ignored.If a fix is necessary, I can provide a PR with the code fix.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: