title: Socket.io client-side javascript file location (with nginx reverse proxy)
body: <p>I'm trying to run multiple NodeJS apps on the same server/port, using nginx as a reverse proxy which proxies to the actual running Node app.</p>
  
  <pre><code>server {
      listen       8000;
      server_name  node.domain.com;
      root         /var/www/node;
  
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
  
      # Enables WS support
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_redirect off;
  
      location / {
          proxy_pass http://127.0.0.1:8001;
      }
  
      location /irc/ {
          proxy_pass http://127.0.0.1:8002;
      }
  
      location /voidwalker/ {
          proxy_pass http://127.0.0.1:8003;
      }
  }
  </code></pre>
  
  <p>As you can see I have different projects (NodeJS apps) running (using <code>forever</code>) in different subdirectories of <code>/var/www/node</code>.</p>
  
  <p>But I want to use <a href="http://www.socket.io" rel="nofollow">socket.io</a> in one of my projects. And in the socket.io docs it states that I should use <code>&lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;</code> to load socket.io-client on the client side, which returns a 404:</p>
  
  <pre><code>GET http://node.domain.com/socket.io/socket.io.js 404 (Not Found)
  </code></pre>
  
  <p>I'm guessing this is because I'm proxying the requests but I don't entirely understand how that process works internally and I would love to get this to work. </p>
  
  <p>Something to note regarding this is that I have to use <code>&lt;link rel="stylesheet" href="/voidwalker/css/main.css"&gt;</code> to load my CSS, while I would rather use <code>&lt;link rel="stylesheet" href="/css/main.css"&gt;</code> in case I want to deploy it on a specific subdomain/other domain (since this is a development server).</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So, after some debugging together with Ray Stantz we think there is something going wrong in the proxy. I moved socket.io.js into <code>/public/js/socket.io.js</code> and I can now use it but this isn't the right solution.</p>
  
  <p>If anyone has any ideas on this, I'll be pleased to hear them and try them out!</p>