I'm running into problems running nginx with both pagespeed and nchan
([https://github.com/slact/nchan](url)) compiled as modules.
When both are compiled with nginx, the messages from nchan are no longer
delivered over websockets. This happens with:
- no pagespeed configuration in nginx.conf
- pagespeed unplugged in nginx.conf
- with a full and working pagespeed configuration in nginx.conf
What startles me the most is that it seems pagespeed is having an effect even
when unplugged or with no configuration.
Debugging this is something I'm not knowledgeable about so I'd appreciate any
pointers or help.
Running Ubuntu 18.04 .01 _4.15.0-33-generic_ and these are the git versions
used:
**nchan** 7b5e6f7d24f10a2ba0a6a38e2b16e0886ec644b0
**nginx** 09cb553c7fb7b1d137db6a2a7f438bb6b6653217
**incubator-pagespeed-ngx** 0d224602e966c431674958dabcaa451c99539352
### To reproduce:
**nginx.conf**
```
user www-data;
pid /run/nginx.pid;
worker_processes auto;
events {
worker_connections 1024;
}
http {
# pagespeed unplugged;
server {
listen 80;
location / {
root /var/www/;
}
location = /sub {
nchan_subscriber;
nchan_channel_id $arg_id;
}
location = /pub {
nchan_publisher;
nchan_channel_id $arg_id;
}
}
}
```
**client.html**
```
<html><head></head><body><h1>Log:</h1><div id="log">Page
loaded<br></div><script>
const socket = new WebSocket('ws://localhost/sub?1234');
socket.addEventListener('message', function (event) {
logit('Message from server "'+event.data+'"');
console.dir(event);
});
socket.addEventListener('open', function (event) { logit('Socket connected');
});
socket.addEventListener('close', function (event) { logit('Socket
disconnected'); });
socket.addEventListener('error', function (event) { logit('Socket error'); });
var logview = document.getElementById('log');
function logit(msg) { console.log(msg); logview.innerHTML = logview.innerHTML +
msg + '<br>'; }
</script></body></html>
```
**Curl to send message to pub**
`curl --request POST --data "Websocket message" http://localhost/pub?1234`
[ Full content available at:
https://github.com/apache/incubator-pagespeed-ngx/issues/1592 ]
This message was relayed via gitbox.apache.org for [email protected]