Thursday 27 December 2018

[error] The client's requested channel transport version "2.0.0" does not match server's version requirements of "~> 1.0"

I always develop with a proxy server in front of my application because it helps avoid common errors in moving from development to production.

Sometimes, however, it can actually cause the error. Today I was wrestling with an error whilst making a minor amend to to the blog engine that currently powers this blog.

I was convinced it was an issue with using an older version of phoenix (1.2.1)

[error] The client's requested channel transport version "2.0.0" does not match server's version requirements of "~> 1.0"

This solution on Stack Overflow seemed to confirm my suspicion and I spent a good thirty minutes checking everything that I could find. I was hitting a deadend.

Then I decided to check my proxy configuration. I use Caddy as a proxy server because it is very lightweight, easy to setup and has a minimal footprint. I had the following configuraiton

dev.curle.io:80,
dev.curle.io:4430 {

  log stdout

  tls _.curle.io.crt _.curle.io.key

  proxy / 127.0.0.1:4000 {
    transparent
  }

}

And I noticed I was missing any websocket configuration. So a one line change into the proxy directive solved the problem.

dev.curle.io:80,
dev.curle.io:4430 {

  log stdout

  tls _.curle.io.crt _.curle.io.key

  proxy / 127.0.0.1:4000 {
    transparent
    websocket
  }

}

And that solved it.