2

My setup, I have a Win11 machine with WSL2 running docker, I have a container of my Laravel application that when making HTTP requests if the body is too big, it gives an error, but the error is generic, it doesn't say it's the size, see:

Laravel application error: cURL error 28: Operation timed out after 60001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for "https://example.com".

So I made the request outside the application and the container, directly in WSL2 with Curl, command: curl -v POST http://example.com -H "Content-Type: application/json" -d @test2.json Command error on WSL2:

<h1>Bad request!</h1>
<p>
     Your browser (or proxy) sent a request that
     this server could not understand.
</p>
<p>
     If you think this is a server error, please contact
     the <a href="mailto:postmaster@localhost">webmaster</a>.
</p>

But I don't think it's the server/url/api, because if I make this request from anywhere else it works, for example through Postaman I sent a body 5 times bigger and it worked and if I run this same command in the terminal from Windows11 it works, same command and same body, but now running from outside WSL (windows cmd, same computer): curl -v POST http://example.com -H "Content-Type: application/json" -d @test2.json works successfully.

What could it be? I've been looking for a solution for over 20 hours.

Dhenyson Jhean
  • 634
  • 6
  • 14
  • 1
    You can try one more thing. Write a route on your local app, that will just print whatever you pass on the body, and then send something locally using Http facade to that URL and see if you still have the error – matiaslauriti Jan 12 '23 at 02:13
  • 2
    what is your PHP's post_max_size set to? This does not looks like laravel's issue but of PHP configuration. – Anuj Shrestha Jan 12 '23 at 04:12
  • I'm using docker "FROM php:8.1". post_max_size = 8M – Dhenyson Jhean Jan 12 '23 at 05:35
  • 2
    So if you send any request using HTTP::post with a post size larget than 1189 to `https://example.com` (or anywhere else) it fails? Can you try (a) using a PHP cURL request directly (b) using a Guzzle request (c) using a cURL request from the command line (the cURL binary) – apokryfos Jan 12 '23 at 07:00
  • 1
    Thanks, it didn't solve the problem, but thanks to these comments I managed to do more detailed tests and I saw that it's not Laravel. I edited my question, title, body and tags so as not to disturb other people. Could you read it again? thanks – Dhenyson Jhean Jan 12 '23 at 13:58

0 Answers0