Unable to disable TLS in websocket connections server

I am trying to deploy a web-socket server which accepts non-TLS websocket connection request (i.e. “ws://” instead of “wss://”).
The server when run locally accepts non-tls requests but when deployed on fly.io, only accepts TLS connections.

fly.toml :

# fly.toml file generated for quiet-star-6957 on 2023-03-16T18:59:11+05:30

app = "quiet-star-6957"
primary_region = "bos"

[build]
  dockerfile = "Dockerfile"
  
[[services]]
  internal_port = 8080
  protocol = "tcp"
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20

  [[services.ports]]
    handlers = ["http"]
    port = "80"

  [[services.ports]]
    handlers = ["tls", "http"]
    port = "443"

  [[services.tcp_checks]]
    interval = 10000
    timeout = 2000

I also tried a potential solution mentioned here where

    tls_options = { "alpn" = ["h2"] }

was added in [[services.ports]] under the “tls” handler.
But, still received the HTTP 426 error.

Thanks!

Fly will handle the TLS parts, your app does not need to provide TLS.

An HTTP 426 error is probably coming from your server. Our proxy will never return anything but 502 or 503 errors (and 301 to redirect to HTTPS), the rest is proxied from your app.

Can you confirm your app works without Fly?

@jerome Yes, the app works fine as expected(without tls) without fly.
What I mean to suggest is that when I host the websocket server locally, it responds expectedly to a websocket protocol request (without tls), But when deployed on fly.io , it responds to instead the websocket secure protocol request.

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