Ws protocol will be changed to wss protocol in Couchbase Lite 2.1.1?

iOS Version: 12.1
Couchbase Lite: 2.1.1

I use nginx to proxy sync gateway. And in iOS client it connects to ws://, however, when I log the network traffic I find the client wants to connect wss://

debug in xcode:

log in Charles:

Does any one have idea about it?


Couchbase Lite will not change ws: to wss:.

The URL itself doesn’t get sent over the wire. Charles only knows the host name, port, and path. I assume it’s reconstructing the scheme name by looking at the port number (and maybe clues in the headers.)

Did you specify an explicit port number in the URL? If you used a port number that’s normally use for SSL (like 443) then Charles may assume you used a wss: scheme.

No, I don’t specify 443 port in the URL? It should connect to 80 port of the remote server.

Then I don’t know why Charles is displaying it that way. Is there an actual problem, or are you just curious about why Charles displays “wss:”?

It’s an actual problem. If I specify 4984 port in the URL like ws://, it works well. However, I use nginx to proxy sync gateway, and then the URL is ws://, it always get 400 response. I find it want to connect 443 port of the remote server as Charles shows.

This is something to do with your proxy. Check its logs to see what Couchbase Lite is actually sending. As I said, Couchbase Lite will not change the url you give it.