Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow

StackOverflow Logo StackOverflow Logo

StackOverflow Navigation

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Add group
  • Feed
  • User Profile
  • Communities
  • Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
Home/ Questions/Q 556
Next

StackOverflow Latest Questions

Saralyn
  • 0
  • 0
SaralynBegginer
Asked: February 21, 20252025-02-21T14:14:28+00:00 2025-02-21T14:14:28+00:00In: PHP

php – Cloudflare 525 SSL Handshake Failed When Reverse-Proxying WebSockets from Apache to Ratchet (wss://)

  • 0
  • 0
php – Cloudflare 525 SSL Handshake Failed When Reverse-Proxying WebSockets from Apache to Ratchet (wss://)

I’m deploying a chat application that uses Ratchet as its WebSocket server. My production setup is as follows:

Web Server (Apache):

Serving my site over HTTPS on port 443 with Let’s Encrypt certificates.
My domain (meetwithchat.com) is proxied through Cloudflare.
Apache Reverse Proxy Configuration:
I configured Apache to reverse-proxy WebSocket connections from a specific path (e.g., /ws) to my Ratchet server running on localhost. My /etc/apache2/sites-available/meetwithchat.conf file is:


    ServerName meetwithchat.com
    ServerAlias www.meetwithchat.com
    DocumentRoot /var/www/meetwithchat

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/meetwithchat.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/meetwithchat.com/privkey.pem

    # Enable reverse proxy for WebSockets:
    ProxyPreserveHost On
    ProxyPass /ws ws://127.0.0.1:2053/
    ProxyPassReverse /ws ws://127.0.0.1:2053/

    ErrorLog ${APACHE_LOG_DIR}/meetwithchat_error.log
    CustomLog ${APACHE_LOG_DIR}/meetwithchat_access.log combined

Ratchet WebSocket Server:
I’m running my Ratchet server without TLS (plain WebSocket) on 127.0.0.1:2053 with this server.php:

run();
?>

Client-Side Code (JavaScript):
The WebSocket is initialized in my script as follows:

ws = new WebSocket("wss://meetwithchat.com/ws");

The Issue:
When I try to connect in Chrome, I receive a Cloudflare 525 error with the message:

“SSL handshake failed. Cloudflare is unable to establish an SSL
connection to the origin server.”

I’ve also tested with OpenSSL (e.g., using port 8443 or 2053 directly), and I encounter TLS handshake failures or connection refused errors when bypassing Cloudflare. Cloudflare’s documentation states that port 2053 and 8443 are supported for HTTPS/WSS, but the issue persists.

What I’ve Tried:

Running my Ratchet server with secure (TLS) configurations directly on non‑standard ports (2053, 8443) resulted in handshake errors.

A minimal TLS test server using my Let’s Encrypt certificate works fine on my VPS when tested directly.

I attempted various TLS option adjustments (e.g., forcing STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, adjusting ciphers, SNI options), but the handshake still fails when proxied through Cloudflare.

Questions:

Has anyone encountered a similar Cloudflare 525 SSL handshake error when reverse-proxying WebSockets from Apache to a Ratchet server?

What is the recommended configuration for reliably terminating TLS at Apache (or Cloudflare) and reverse-proxying WebSocket traffic to a non-TLS Ratchet server?

Are there known compatibility issues with ReactPHP’s SecureServer when using Let’s Encrypt certificates behind Cloudflare that might be causing these handshake failures?

0
  • 0 0 Answers
  • 68 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • Popular
  • Answers
  • W3spoint99

    What is Physics? Definition, History, Importance, Scope (Class 11)

    • 1 Answer
  • W3spoint99

    The Living World – Introduction, Classification, Characteristics, FAQs (Class 11 ...

    • 1 Answer
  • W3spoint99

    Explain - Biological Classification (Class 11 - Biology)

    • 1 Answer
  • Saralyn
    Saralyn added an answer When Humans look at their childhood pictures, the first thing… January 17, 2025 at 3:25 pm
  • Saralyn
    Saralyn added an answer Previously, length was measured using units such as the length… January 17, 2025 at 3:25 pm
  • Saralyn
    Saralyn added an answer Measurement forms the fundamental principle to various other branches of… January 17, 2025 at 3:25 pm

Related Questions

  • Reading fancy apostrophe PHP [duplicate]

    • 0 Answers
  • Unable to send mail via PHPMailer [SMTP->Error: Password not accepted ...

    • 0 Answers
  • Concerns when migrating from PHP 5.6 to 8.4 [closed]

    • 0 Answers
  • Laravel Auth::attempt() error: "Unknown column 'password'" when using a custom ...

    • 0 Answers
  • Core PHP cURL - header origin pass null value

    • 0 Answers

Trending Tags

biology class 11 forces how physics relates to other sciences interdisciplinary science learn mathematics math sets tutorial null sets physics physics and astronomy physics and biology physics and chemistry physics applications science science connections science education sets in mathematics set theory basics types of sets types of sets explained

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

  • About US
  • Privacy Policy
  • Questions
  • Recent Questions
  • Web Stories

© 2025 WikiQuora.Com. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.