NGINX+Nchan Long-polling on Public URL with HTTPS


I am trying to get my Long-Polling setup (NGINX+Nchan) working behind the VPN/Reverse Proxy. It runs like a charm when I use http://public-url/myapp/receive , but it is broken when I switch to https://public-url/myapp/receive

This setup provides me some kind of bus to provide feedback on the user web interface connected to the server, through a javascript translating those messages to visual messages on the web page.

Is it a known issue? … maybe already a the roadmap? If not, how can I document more than that?

My nginx config (section for PUSH) is the following:


location /myapp {
    location /myapp/send {
        nchan_channel_id myapp;
        nchan_store_messages on; 
    push_message_timeout 5s;               # Give the clients time
        nchan_message_buffer_length 10;  # to catch up
    location /myapp/receive {
        nchan_channel_id myapp;
        default_type text/plain; 
    send_timeout 3600;

Thank you in advance, Henry


@theonlyzby Are you sending HTTP requests or opening a socket connection to your device? What error messages do you see on your web interface when trying to run over HTTPS?
Could you post the web interface code you are using to connect to the device?


Thank you @lucianbuzzo to still have a look and pull my issue out of water!
In the meantime, I have to say, I thought it was just left without attention, so haven’t updated … my bad!

Yes, I found the issue some days ago … it was due to xajax (PHP Class Library- to develop asynchronous Ajax applications with PHP) which rebuilds an absolute URL on the server side, so, when in the browser I was using private URL with HTTPS, on the server it was still seen as HTTP, so absolute URL was http://public-resin–url/myapp/receive which … was blocked by Chrome because in infringement with cross-site scripting security rule! So, I modified the /xajax/xajax_core/ so that he generates relative URL which is rebuilt in the browser … so keeps using HTTPS and Bingo! :wink:

Line 990 - $sURL = $aURL[‘scheme’].’://’;
Line 990 + $sURL = ‘’;

Line 1000 - $sURL.= $aURL[‘host’];
Line 1000 - $sURL.= ‘’;

I hope it can help others… Henry