Elixir Websockets connection failed

We are using absinthe for websockets connections, it’s working fine in dev, but in our stage environment we get the following error: WebSocket connection to ‘wss://outsite.com/websocket/websocket?vsn=1.0.0’ failed.

To make it work on dev I had to change:

config :site, SiteWeb.Endpoint,
    check_origin: false,

Now on stage, after that change, the error appears. This is the full config of stage:

use Mix.Config

api_url = System.get_env("API_URL") || raise "Missing API_URL."

config :site,
  canonical_host: api_url

config :site, SiteWeb.Endpoint,
  debug_errors: debug_errors,
  server: true,
  http: [
    port: 80,
    protocol_options: [max_keepalive: 5_000_000]
  url: [host: api_url],
  force_ssl: [hsts: true, rewrite_on: [:x_forwarded_proto]],
  https: [
    port: 443,
    sni_fun: &SiteWeb.Endpoint.ssloptions/1,
    otp_app: :site,
    cipher_suite: :strong,
    protocol_options: [max_keepalive: 5_000_000],
    keyfile: ssl_path <> api_url <> "/privkey.pem",
    cacertfile: ssl_path <> api_url <> "/chain.pem",
    certfile: ssl_path <> api_url <> "/cert.pem",
    versions: [:"tlsv1.3", :"tlsv1.2"],
    honor_cipher_order: true,
    ciphers: [
    eccs: [:x25519, :secp256r1, :secp384r1],
    secure_renegotiate: true,
    reuse_sessions: true
  check_origin: false,
  cache_static_manifest: "priv/static/cache_manifest.json",
  secret_key_base: secret_key_base

What could I be doing wrong?

Hi! What is the error?