-
Notifications
You must be signed in to change notification settings - Fork 70
fix PHP Post #8
fix PHP Post #8
Conversation
While this does paper over the issue, it also is weirdly overriding specific behavior (setting the Content-Length header to a certain value). I'd like to know more about why the Content-Length header is set incorrectly before overriding its value. Why is the built-in php webserver returning 0 for the response body length? |
hey @txase I Think it is a PHP CURL known-bug... |
The SO link says: If you want to send a request body, make sure to set the Content-Length header to the length of the body. This change does something different. It overrides the Content-Length header value that is provided in the request. We can do that, but it's probably a sign that the client simply is making an invalid request. Since this is coming through an ALB, can you get a dump of the request (including headers and body) sent to the ALB so we can verify whether it is setting the Content-Length header appropriately? |
Hey @txase,
|
The ALB event has the correct content-length value. The api gateway event is missing the content-length. I would expect the ALB request to work, but the api gateway request not to. But you're saying the ALB request is not working, while the api gateway is working? |
@txase you are correct.. I Have no idea why, and i agree it should not be treated as "official" fix.. I Will keep checking if we can solve this in another way. Feel free to close the PR if you wish |
That's very strange. I'm going to close this PR as there doesn't seem to be evidence that the layer itself is doing something wrong, but please re-open if you make any progress on the core issue! |
Hi,
Testing in our environment we found a bug when sending the content-length Header via ALB.
The curl call stucks which i think it's a bug: https://stackoverflow.com/questions/9340734/php-curl-data-not-posted-if-headers-are-set
I Managed to fix by making the header on-the fly with the actual sent body.
For this i changed the order where we call the CURLOPT_HTTPHEADER to after the $body variable is defined.