Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ratchet - Apache - Rocky Linux - HTTP ERROR 426 #1068

Open
rsclmumbai opened this issue Jul 8, 2024 · 2 comments
Open

Ratchet - Apache - Rocky Linux - HTTP ERROR 426 #1068

rsclmumbai opened this issue Jul 8, 2024 · 2 comments

Comments

@rsclmumbai
Copy link

Rocky Linux release 9.3 (Blue Onyx)
Server version: Apache/2.4.57
PHP 8.2.18

<VirtualHost *:80>
ServerName myhost.mydomain.com
ServerAlias myhost.mydomain.com
DocumentRoot /var/www/html
RewriteEngine on
RewriteCond %{SERVER_NAME} =myhost.mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
ServerName myhost.mydomain.com
ServerAlias myhost.mydomain.com
DocumentRoot /var/www/html
ProxyPass / ws://127.0.0.1:8080/$1
SSLCertificateFile /etc/letsencrypt/live/myhost.mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/myhost.mydomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
error_reporting(E_ALL); ini_set('display_errors', 1);
        use Ratchet\Server\IoServer;
        use Ratchet\Http\HttpServer;
        use Ratchet\WebSocket\WsServer;
        use MyChatApp\Chat;

        require dirname(__DIR__) . '/vendor/autoload.php';
        $server = IoServer::factory(
                    new HttpServer(
                        new WsServer(
                            new Chat()
                        )
                    ),
                  8080
                 );
        $server->run();

Everything had been working fine for the last 3 months. but since an hour, I'm getting this error:
HTTP ERROR 426

I have been on Google for the last hour and I'm unable to find a solution. Can someone please help me... My services are down..

Please help!!

@amiel0606
Copy link

Hi, have you hosted your work? May I know how and I have been stuck with this problem for 2 days now.

@ev-gor
Copy link

ev-gor commented Jan 10, 2025

In the case of a WebSocket connection, error 426 means that a client's request lacks some required headers for the connection upgrade. We must instruct Apache to add these headers. For this, the code in your Apache conf file should look like this:

    #we must add special headers to the websocket request
    RewriteEngine On
    RewriteCond %{HTTP:Connection} Upgrade [NC]
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteRule /(.*) ws://127.0.0.1:8080/$1 [P,L]

    #redirect an external request to our local websocket server
    ProxyPass / ws://127.0.0.1:8080
    ProxyPassReverse / ws://127.0.0.1:8080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants