Broken http request after event.$fetch
Nuxt 4.2.2
After I build my nuxt app and make a fetch request which is doing also 2 requests (1 intern, 1 extern) i get an broken http request error from the receiving host.
I have a Proxy in /api/proxy/[...]
And a endpoint /api/test.post.ts
Server B is lets say localhost:8080
The proxy just adds a jwt token into authorisation header Like this:
in /api/test.post.ts:
I get in Server B following error:
[2025-12-19 16:43:20 +0100] [30] [WARNING] Invalid request from ip=10.200.1.2: Invalid HTTP request line: 'wMDAwMDAwMDAiLCJhdWQiOiJTZXJtb255TWVkaWFTZXJ2ZXIiLCJpc3MiOiJTZXJtb255In0.WZfI
It doesnt even reach the endpoint.
But if I remove the first fetch (event.$fetch) Or if I am in dev mode, then it works.
It’s a JWT token that is generated beforehand. It is passed exactly as shown. However, it’s not very relevant here because the target server never reaches token validation. The request is aborted due to the error. It looks like the HTTP request is malformed, and it seems that event.$fetch is somehow modifying it, causing the second request to fail before it reaches any application code.
After I build my nuxt app and make a fetch request which is doing also 2 requests (1 intern, 1 extern) i get an broken http request error from the receiving host.
I have a Proxy in /api/proxy/[...]
And a endpoint /api/test.post.ts
Server B is lets say localhost:8080
The proxy just adds a jwt token into authorisation header Like this:
in /api/test.post.ts:
I get in Server B following error:
[2025-12-19 16:43:20 +0100] [30] [WARNING] Invalid request from ip=10.200.1.2: Invalid HTTP request line: 'wMDAwMDAwMDAiLCJhdWQiOiJTZXJtb255TWVkaWFTZXJ2ZXIiLCJpc3MiOiJTZXJtb255In0.WZfI
It doesnt even reach the endpoint.
But if I remove the first fetch (event.$fetch) Or if I am in dev mode, then it works.
It’s a JWT token that is generated beforehand. It is passed exactly as shown. However, it’s not very relevant here because the target server never reaches token validation. The request is aborted due to the error. It looks like the HTTP request is malformed, and it seems that event.$fetch is somehow modifying it, causing the second request to fail before it reaches any application code.
