How to set up an apache proxy for Meteor/SockJS and WebSocket?

后端 未结 5 1953
猫巷女王i
猫巷女王i 2020-12-05 12:31

I have an apache proxy for a meteor app and apache and meteor are on two separate machines. I need it that way as apache has to serve a lot of real websites and it wouldn\'t

5条回答
  •  庸人自扰
    2020-12-05 12:54

    Fatih-Arslan's answer with Derwiwie's amendment worked like charm. One thing I had to use was putting wss instead of ws, because my service works only in https.

    RewriteEngine on  
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]  
    RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]  
    RewriteRule .* wss://localhost:3000%{REQUEST_URI} [P]
    

提交回复
热议问题