mboynes's avatar
Level 10

cURL error 1: Received HTTP/0.9 when not allowed

I have an app that uses Pusher and has for the past 4+ years. I'm trying out reverb locally to see if I can replace Pusher, and I'm running into an error that I can't track down.

I'm running the site locally, and I use Valet. MacOS 15.1, Laravel 11.23.5, PHP 8.3.6. I'm starting reverb with the following command:

artisan reverb:start --host="0.0.0.0" --port=8080 --hostname="my-app.test"

When I open the app, the WS connection establishes and at first it seems like things just work, as presence channels work and I can see when users appear online and go offline. However, when I make an update that dispatches an event (using event()), I get the following exception:

[2024-11-20 12:29:45] local.ERROR: cURL error 1: Received HTTP/0.9 when not allowed (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://my-app.test:8080/apps/445426/events?auth_key=xxx&auth_timestamp=1732123785&auth_version=1.0&body_md5=yyy&auth_signature=zzz {"userId":2,"exception":"[object] (GuzzleHttp\\Exception\\RequestException(code: 0): cURL error 1: Received HTTP/0.9 when not allowed (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for [...] /[...]/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:276)

I'm hoping someone has an idea of why this is happening and where I've gone wrong. I searched reverb's codebase and couldn't find any mention of HTTP/0.9, so I don't know where this might be coming from. I checked GitHub issues in reverb and didn't see any mention of this, and googled around and found nothing, so I have to imagine this is some sort of me problem. I could probably proxy through nginx to get around the issue, but I'd really like to get to the bottom of it before I feel comfortable replacing a stable, working solution (albeit a pricey one) in production. Thanks in advance for any help!

0 likes
4 replies
LaryAI's avatar
Level 58

The error you're encountering, "cURL error 1: Received HTTP/0.9 when not allowed," typically indicates that the server is responding with an HTTP/0.9 response, which is not supported by modern HTTP clients like Guzzle. This can happen if the server is not properly configured to handle HTTP/1.0 or HTTP/1.1 requests, or if there's a misconfiguration in the server setup.

Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check Server Configuration: Ensure that the server (Reverb in this case) is configured to handle HTTP/1.1 requests. You might need to check the server's documentation or configuration files to ensure it's set up correctly.

  2. Verify Reverb Setup: Double-check the command you use to start Reverb. Ensure that the host and port are correctly set and that Reverb is configured to handle HTTP/1.1 requests. You might want to try different ports or host configurations to see if the issue persists.

  3. Use a Proxy: As a temporary workaround, you can set up a local proxy using Nginx or Apache to forward requests to Reverb. This can help ensure that the requests are properly formatted and that the server responds with the correct HTTP version.

    Here's a basic example of how you might configure an Nginx proxy:

    server {
        listen 80;
        server_name my-app.test;
    
        location / {
            proxy_pass http://localhost:8080;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }
    

    This configuration forwards requests from my-app.test to localhost:8080, where Reverb is running.

  4. Check for Updates: Ensure that both Reverb and any related libraries (like Guzzle) are up to date. Sometimes, bugs or compatibility issues are resolved in newer versions.

  5. Debugging: Add logging or debugging statements in your application to capture the exact request and response headers. This can help identify if there's a specific part of the request causing the issue.

  6. Contact Reverb Support: If the issue persists, consider reaching out to Reverb's support or community forums. There might be known issues or additional configuration steps required for your specific setup.

By following these steps, you should be able to identify and resolve the issue with the HTTP/0.9 response. If you continue to experience problems, further investigation into the server's response handling might be necessary.

mboynes's avatar
Level 10

I figured out a solution to this issue, though perhaps not the solution (maybe it is? I'm honestly not certain).

I updated REVERB_SCHEME=https, which is set to http by default in .env. That yielded a different error:

cURL error 60: SSL certificate problem: unable to get local issuer certificate

... one which is well-documented and easily resolved. The path I took was to add valet's self-signed cert (stored in ~/.config/valet/CA/LaravelValetCASelfSigned.pem) to the end of openssl's cert.pem file (for me, via homebrew, this was located at /opt/homebrew/etc/ca-certificates/cert.pem, which I found via php -i | grep "cert.pem").

After resolving this, reverb appears to be working beautifully as advertised!

Perhaps there's still an answer out there to the HTTP/0.9 issue and why that was coming up for me, but at the very least, if anyone else encounters that issue they can read this response for a path forward.

1 like
faraweilyas's avatar

I'm experiencing this same issue, unfortunately your solution didn't work for me

Please or to participate in this conversation.