Middleware edge functions do not support POST request with "Expect: 100-continue" HTTP header
See original GitHub issueSteps to reproduce:
- Add any valid
_middleware.ts
to a NextJS application. - Deploy to Vercel
- Make a POST request to any url where that middleware will be run with:
Expect: 100-continue
as an HTTP header, and any non-emptybody
content.
Result:
We get a 502 Bad Gateway
with the following response body:
An internal error occurred with Vercel.
INTERNAL_EDGE_FUNCTION_CONNECTION_CLOSED
In the function log, we get a message that the middleware was called, but the code does not execute (adding a console.info in the middleware does not show up in the function log)
Expected result:
Middleware and page or api executes appropriately.
Expect: 100-continue
is part of the HTTP 1.1 spec and should be implemented, or should be documented explicitly as not implemented.
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:29 (2 by maintainers)
Top Results From Across the Web
Using Next.js' middleware and Edge Functions
Middleware is a Next.js feature that solves basic problems like authentication and geolocation with the help of Vercel Edge Functions.
Read more >Proper Node.js API for determining whether or not `100 ...
This seems to work: server.on('checkContinue', (req, res) => { res.mySent100 = true; res.writeContinue(); server.emit('request', req, ...
Read more >'Expect: 100-Continue' Issues and Risks
API POST requests sent using HTTP clients and with an Expect: 100-Continue request header are significantly more likely to fail that...
Read more >Request draining with ASP.NET Core Kestrel web server
The app doesn't always consume the request body, such as HTTP POST ... better for clients to use the Expect: 100-continue request header...
Read more >Restrictions on edge functions - Amazon CloudFront
The following HTTP headers are not exposed to edge functions, and functions can't add them. If your function adds one of these headers,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
👋 We are having the same issue since 12hours ago as well. Seems like POST requests from some locations (confirmed via VPN for the UK) run into a 502 - INTERNAL_EDGE_FUNCTION_CONNECTION_CLOSED
From other parts of the world we do not see such a problem
We brought back the middleware, working as expected. There was an issue on Vercel’s end which has been fixed.