Comments (6)
undici fixed this in nodejs/undici#2046 , but not sure if it'll be backported to LTS. I'm using nitro.experimental.nodeFetchCompat
till that fix makes to a node LTS 👀
from httpxy.
I'm facing the same issue using Nuxt,js routeRules proxy and my DELETE requests don't work.
Putting
delete opts.fetchOptions.headers['content-length']
before this line
https://github.com/unjs/h3/blob/12ccb81432a62783fe951a8170976c8162bce44a/src/utils/proxy.ts#L77
solves my issue, otherwise it fails with a UND_ERR_REQ_CONTENT_LENGTH_MISMATCH.
I'm haven't digged deep enough into the ecosystem to understand fully what's going on, I'd really appreciate if someone could explain further what exactly is happening / provide a workaround.
For now I might have to use a different proxy.
If wanted, I'm happy to do some digging myself. (not sure how efficient I'll be here though)
from httpxy.
You might also need to disable built-in fetch. I'm using this kind of setup:
// package.json
"scripts": {
"dev": "pnpm nuxt dev",
"build": "pnpm nuxt build",
"generate": "pnpm nuxt generate",
"preview": "pnpm nuxt preview",
"postinstall": "pnpm nuxt prepare",
"nuxt": "NODE_OPTIONS='--no-experimental-fetch' nuxt"
}
// nuxt.config.ts
export default defineNuxtConfig({
nitro: {
experimental: {
nodeFetchCompat: true
}
}
})
At the time I posted that comment, it was working fine just by setting in nuxt.config, but broke between some Nuxt minor IG. So you might need to add both. I have confirmed that it works fine in latest Node.js without any extra config, so probably this issue can be closed as I think this was always an upstream issue.
PS: I just read [email protected] release notes and looks like it should now work fine on latest LTS too. 🎉
from httpxy.
Thanks for the issue. Related upstream issues http-party/node-http-proxy#1343 and nodejs/node#27880
This feature was originally introduced in http-proxy via http-party/node-http-proxy#742 as part of bug fix for nginx and chunked streaming. I will have to check it more in defails.
Anyway i think it is a valid bug if we are overriding the existing content-length.
from httpxy.
@brc-dd can you explain what you mean by using nitro.experimental.nodeFetchCompat?
I can't find much about it, what it is and how do I set it in my Nuxt config? 😄
I tested this issue with node 18, 20 and 21 and it persists in all versions. My current workaround is to add something random in the body of the DELETE request, which is quiet ugly...
from httpxy.
export default defineNuxtConfig({
nitro: {
experimental: {
nodeFetchCompat: true
}
}
})
from httpxy.
Related Issues (13)
- Dependency Dashboard
- Triage from upstream issues and PRs HOT 2
- Enable ts strict checks
- Target path is not being set correctly when prepending path
- Introduce httpxy cli
- Relative URL for Location response header causes TypeError (e.g. 201 Created)
- UNIX socket support
- Action Required: Fix Renovate Configuration
- Support HTTP2/3
- All unjs official code base documentation is very poor
- WTF? I encountered a problem and asked for a solution. Did you close my issue? HOT 1
- Rewrite request and response (MITM proxy)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpxy.