Adding websocket support
Couhbase Lite iOS 1.0.3 introduces websocket support for the changes feed, but by default nginx will not upgrade it’s connection to Sync Gateway to support websockets. If an iOS client has websockets enabled for the _changes feed it will be unable to to pull replicate from a Sync Gateway behind an nginx reverse proxy. To enable websockets support, update the location block by adding the following two directives.
1 2 3 4 5 6 7 8 |
location / { . . proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; . . } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
location / { index index.html index.htm; } location ~* \.(css|js)$ { gzip on; gzip_http_version 1.1; gzip_types text/css application/javascript application/x-javascript; gzip_buffers 4 8k; gzip_min_length 1000; gzip_comp_level 1; gzip_proxied off; gzip_disable "MSIE [1-6]\." "Mozilla/4"; gzip_vary off; expires 30d; } location ~* \.(json|ttf|woff|otf|eot)$ { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Headers' 'Content-Type,Accept'; add_header 'Access-Control-Allow-Method' 'GET, POST, OPTIONS, PUT, DELETE'; } |