Phoenix websockets not working in DigitalOcean droplet

I deployed a phoenix project using distillery to my DigitalOcean droplet (Ubuntu 14.04, 4GB RAM, 2 CPUs), and normal http requests to the server work just fine (i.e. visit

However, when trying to connect to a channel I get this error in the chrome console phoenix.js:697 WebSocket connection to 'wss://' failed: WebSocket opening handshake was canceled.

The websockets work fine locally, but how can I get them working on my droplet?

This is from my NGinx conf file, the pheonix docs also say you need this:

    location @proxy {
        include proxy_params;
        proxy_redirect off;
        proxy_pass http://sitename;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
1 Like

I’m not using any proxies in from of phoenix. Shouldn’t channels work without

1 Like

Ah sorry, I made the assumption you were using Nginx. Your correct it should work without it though, although I have never done it this way. I just know that when I had that problem, that fixed it. Have you checked you prod.ex to make sure everything is correct there?

My prod.ex is pretty standard

use Mix.Config

config :server, Server.Endpoint,
  url: [host: "", port: 80],
  http: [port: 80],
  # force_ssl: [hsts: true]
  https: [otp_app: :server,
          port: 443,
          keyfile: "priv/privkey.pem",
          certfile: "priv/cert.pem"],
  server: true

# Do not print debug messages in production
config :logger, level: :info

# Finally import the config/prod.secret.exs
# which should be versioned separately.
import_config "prod.secret.exs"

Does https work?