Ws protocol will be changed to wss protocol in Couchbase Lite 2.1.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://xxx.com/syncgateway, however, when I log the network traffic I find the client wants to connect wss://xxx.com/syncgateway.

debug in xcode:

log in Charles:

Does any one have idea about it?

Regards


#2

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.


#3

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


#4

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:”?


#5

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


#6

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.