# How to fix SSL wrong version number?

**URL:** https://meta.discourse.org/t/how-to-fix-ssl-wrong-version-number/385239
**Category:** Support
**Tags:** unsupported-install, onebox
**Created:** [October 10, 2025, 2:15pm UTC](https://meta.discourse.org/t/how-to-fix-ssl-wrong-version-number/385239 "2025-10-10T14:15:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![MoRanYue](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moranyue/32/523065_2.png) [@MoRanYue](https://meta.discourse.org/u/MoRanYue)
#### Post date: [October 10, 2025, 2:15pm UTC](https://meta.discourse.org/t/how-to-fix-ssl-wrong-version-number/385239/1 "2025-10-10T14:15:36Z")

</div>

I found that my Discourse cannot generate OneBox for any websites except YouTube, when checking out the log, I saw this error thrown:

```plaintext
Failed to onebox https://bilibili.com SSL_connect returned=1 errno=0 peeraddr=192.168.50.1:10808 state=error: wrong version number (OpenSSL::SSL::SSLError) ["/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/ssl_socket.rb:151:in 'OpenSSL::SSL::SSLSocket#connect_nonblock'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/ssl_socket.rb:151:in 'Excon::SSLSocket#initialize'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:487:in 'Class#new'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:487:in 'Excon::Connection#socket'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:120:in 'Excon::Connection#request_call'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/mock.rb:57:in 'Excon::Middleware::Mock#request_call'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/instrumentor.rb:34:in 'Excon::Middleware::Instrumentor#request_call'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/idempotent.rb:19:in 'Excon::Middleware::Idempotent#request_call'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/base.rb:22:in 'Excon::Middleware::Base#request_call'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/decompress.rb:14:in 'Excon::Middleware::Decompress#request_call'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/base.rb:22:in 'Excon::Middleware::Base#request_call'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:293:in 'Excon::Connection#request'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon.rb:252:in 'Excon.head'", "/home/mry/discourse/lib/final_destination.rb:268:in 'Kernel#public_send'", "/home/mry/discourse/lib/final_destination.rb:268:in 'FinalDestination#resolve'", "/home/mry/discourse/lib/oneboxer.rb:497:in 'block in Oneboxer.external_onebox'", "/home/mry/discourse/lib/cache.rb:93:in 'Cache#fetch'", "/home/mry/discourse/lib/oneboxer.rb:482:in 'Oneboxer.external_onebox'", "/home/mry/discourse/lib/oneboxer.rb:285:in 'Oneboxer.onebox_raw'", "/home/mry/discourse/lib/oneboxer.rb:96:in 'Oneboxer.onebox'", "(discourse):4:in '<main>'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb/workspace.rb:101:in 'Kernel#eval'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb/workspace.rb:101:in 'IRB::WorkSpace#evaluate'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb/context.rb:591:in 'IRB::Context#evaluate_expression'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb/context.rb:557:in 'IRB::Context#evaluate'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:201:in 'block (2 levels) in IRB::Irb#eval_input'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:512:in 'IRB::Irb#signal_status'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:193:in 'block in IRB::Irb#eval_input'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:272:in 'block in IRB::Irb#each_top_level_statement'", "<internal:kernel>:168:in 'Kernel#loop'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:269:in 'IRB::Irb#each_top_level_statement'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:192:in 'IRB::Irb#eval_input'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:173:in 'block in IRB::Irb#run'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:172:in 'Kernel#catch'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb.rb:172:in 'IRB::Irb#run'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/commands/console/irb_console.rb:113:in 'Rails::Console::IRBConsole#start'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/commands/console/console_command.rb:59:in 'Rails::Console#start'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/commands/console/console_command.rb:8:in 'Rails::Console.start'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/commands/console/console_command.rb:87:in 'Rails::Command::ConsoleCommand#perform'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/thor-1.4.0/lib/thor/command.rb:28:in 'Thor::Command#run'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/thor-1.4.0/lib/thor/invocation.rb:127:in 'Thor::Invocation#invoke_command'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/command/base.rb:178:in 'Rails::Command::Base#invoke_command'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/thor-1.4.0/lib/thor.rb:538:in 'Thor.dispatch'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/command/base.rb:73:in 'Rails::Command::Base.perform'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/command.rb:65:in 'block in Rails::Command.invoke'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/command.rb:143:in 'Rails::Command.with_argv'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/command.rb:63:in 'Rails::Command.invoke'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/railties-8.0.3/lib/rails/commands.rb:18:in '<main>'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'", "/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/bootsnap-1.18.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in 'Kernel#require'", "bin/rails:18:in '<main>'"]

```

Tested `Oneboxer.onebox('https://bilibili.com')` invocation in `rails c`, then getting the same error.

I do not know why and feel puzzled now, because Discourse can process OAuth and AI request and other HTTP requests with no errors, it only happened to OneBox, but YouTube OneBox can be normally generated.

It was using a proxy server now and I am sure that this is not proxy’s problem, `curl`, `wget` and `httpx` module in Python could fetch response successfully, but `excon` in Ruby gave me `SSL: wrong version number`, what should I do to fix it?

I used `3.0.13` release of OpenSSL, which was published in Jan. 2024, when compiling the Ruby interpreter, is that version too old?

---

<div class="post-metadata">

### Author: ![MoRanYue](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moranyue/32/523065_2.png) [@MoRanYue](https://meta.discourse.org/u/MoRanYue)
#### Post date: [October 10, 2025, 2:28pm UTC](https://meta.discourse.org/t/how-to-fix-ssl-wrong-version-number/385239/2 "2025-10-10T14:28:15Z")

</div>

More supplement: Executing `Excon.get` in `rails c`, got the same. Maybe it is a problem from `excon` library?

```sh
discourse(prod)> Excon.get('https://bilibili.com')
(discourse):3:in '<main>': SSL_connect returned=1 errno=0 peeraddr=192.168.50.1:10808 state=error: wrong version number (OpenSSL::SSL::SSLError) (Excon::Error::Socket)
/home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/ssl_socket.rb:151:in 'OpenSSL::SSL::SSLSocket#connect_nonblock': SSL_connect returned=1 errno=0 peeraddr=192.168.50.1:10808 state=error: wrong version number (OpenSSL::SSL::SSLError)
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/ssl_socket.rb:151:in 'Excon::SSLSocket#initialize'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:487:in 'Class#new'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:487:in 'Excon::Connection#socket'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:120:in 'Excon::Connection#request_call'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/mock.rb:57:in 'Excon::Middleware::Mock#request_call'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/instrumentor.rb:34:in 'Excon::Middleware::Instrumentor#request_call'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/idempotent.rb:19:in 'Excon::Middleware::Idempotent#request_call'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/base.rb:22:in 'Excon::Middleware::Base#request_call'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/decompress.rb:14:in 'Excon::Middleware::Decompress#request_call'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/middlewares/base.rb:22:in 'Excon::Middleware::Base#request_call'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon/connection.rb:293:in 'Excon::Connection#request'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/excon-1.2.5/lib/excon.rb:252:in 'Excon.get'
        from (discourse):3:in '<main>'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb/workspace.rb:101:in 'Kernel#eval'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb/workspace.rb:101:in 'IRB::WorkSpace#evaluate'
        from /home/mry/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/irb-1.15.2/lib/irb/context.rb:591:in 'IRB::Context#evaluate_expression'
        ... 28 levels...

```

I will be grateful if anyone could have a effective solution

---

<div class="post-metadata">

### Author: ![pangbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pangbo/32/538562_2.png) [@pangbo](https://meta.discourse.org/u/pangbo)
#### Post date: [October 11, 2025, 5:21pm UTC](https://meta.discourse.org/t/how-to-fix-ssl-wrong-version-number/385239/3 "2025-10-11T17:21:52Z")

</div>

Try replacing [https://github.com/discourse/discourse/blob/main/config%2Finitializers%2F013-excon\_defaults.rb](https://github.com/discourse/discourse/blob/main/config%2Finitializers%2F013-excon_defaults.rb) with:

```plaintext
require "excon"
Excon::DEFAULTS[:include_default_port] = true

```

Due to a misconfiguration of Excon, the port number was not being passed when using an HTTP proxy. Consequently, the proxy server was connecting to the remote server using port 80, while Excon was still attempting to decrypt the HTTP content using TLS.

---

<div class="post-metadata">

### Author: ![MoRanYue](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moranyue/32/523065_2.png) [@MoRanYue](https://meta.discourse.org/u/MoRanYue)
#### Post date: [October 14, 2025, 7:32pm UTC](https://meta.discourse.org/t/how-to-fix-ssl-wrong-version-number/385239/4 "2025-10-14T19:32:56Z")

</div>

Good! The onebox starts to work well.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 13, 2025, 7:33pm UTC](https://meta.discourse.org/t/how-to-fix-ssl-wrong-version-number/385239/6 "2025-11-13T19:33:37Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
