Open TobiasMorell opened 5 years ago
same thing here on two laravel projects with POST requests, any recommendation ??
I ended up giving up, so sadly no recommendations from my side.
Maybe this old piece of code would give an idea. https://github.com/gentics/proxy-php/commit/d825be13e4705616c2000b8f97a4237defbdb9b9
It seems to be related to chunked transfer encoding.
My caddy reverse proxy server gets this error:
{"level":"error","ts":1618986004.5862067,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"invalid byte in chunk length"}
{"level":"error","ts":1618986004.5862992,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"invalid byte in chunk length"}
I've worked around it by just removing that transfer encoding header just before emiting and it seems to work alright:
// chunked transfer encoding is broken; try just removing the header
if ($response->getHeader('Transfer-Encoding')[0] ?? "" === "chunked") {
$response = $response->withoutHeader('Transfer-Encoding');
}
(new Laminas\HttpHandlerRunner\Emitter\SapiEmitter)->emit($response);
die();
I'm trying to use this proxy to forward requests to an ASP.NET server on another domain. When I send a login request (POST to /api/login, request body containing a form) directly to the ASP.NET server it works fine, but when it has passed through the proxy I get an exception:
This exception occurs when I attempt to read the form from the request body.
I'm running the proxy with the default setup as provided in the readme file. Do I need to do something special to have the proxy include the forms in the proxied requests?