Meteor on httpd (Apache/2.4.6 CentOS) proxy and WebSockets -


i can't workout how websockets work when deploy meteor app online. keep getting error:

websocket connection 'ws://website.com/sockjs/***/********/websocket' failed: unexpected response code: 400 

i think due fact apache sits in front of meteor app. know apache 2.4 had bug make ws:// working, think should resolved modules/mod_proxy_wstunnel.so, have enabled (of course have enabled modules/mod_proxy.so)

here's config. i'm running meteor 1.2.1 systemd service (/etc/systemd/system/meteor.service) so:

[unit] description=meteor nodejs daemon after=network.target remote-fs.target  [service] user=root execstart=/usr/bin/node /home/root/www/main.js restart=always standardoutput=syslog standarderror=syslog syslogidentifier=meteor environment=root_url=http://website.com environment=port=3000 environment=node_env=production environment=mongo_url=mongodb://127.0.0.1:27017/meteor  [install] wantedby=multi-user.target 

this output of httpd -v

server version: apache/2.4.6 (centos) server built:   aug 28 2015 22:11:18 

and relevant part in vhost config (/etc/httpd/conf/httpd.conf) website.com:

<virtualhost my.ser.ver.ip:8080>     servername website.com     serveralias www.website.com     proxyrequests off     proxypass / http://localhost:3000/     proxypassreverse / http://localhost:3000/     <proxy *>         allow     </proxy> </virtualhost> 

i've tried add rewritecond suggested here no success...

any idea? i'm having issue getting oauth work accounts-facebook package , guess problem same reason? in, there wrong in proxy settings?

solved mystery. of course bad: forgot varnish.

i had varnish set on port 80 forwarding request apache, in turn proxying request node.js. resolved removing apache , configuring varnish serve straight node.js specific domain.

this did:

  1. implemented this default.vcl in /etc/varnish/
  2. removed import directors , content inside sub vcl_init {} (as have single server)
  3. replaced set req.backend_hint = vdir.backend(); in sub vcl_recv {} with:

if (req.http.host ~ "^(www\.)?website.com") {     set req.backend_hint = nodejs; } else {     set req.backend_hint = apache; } 
  1. created 2 backends so:

backend apache {     .host = "127.0.0.1";     .port = "8080";     .max_connections = 300;     .probe = {         .request =             "head / http/1.1"             "host: localhost"             "connection: close";         .interval = 5s;         .timeout = 1s;         .window = 5;         .threshold = 3;     }     .first_byte_timeout = 300s;     .connect_timeout = 5s;     .between_bytes_timeout = 2s; }  backend nodejs {     .host = "127.0.0.1";     .port = "3000";     .connect_timeout = 1s;     .first_byte_timeout = 2s;     .between_bytes_timeout = 60s;     .max_connections = 800; } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -