title: socket.io on aws application load balancer
body: <p>So I've been in the process of shifting from targeting an ec2 instance directly over to an application load balancer. Doing this, I've had issues connecting to my socket (it was working fine before). All my ALB requests work fine, just the socket being the issue. Here's my setup/config:
  My ALB config
  <a href="https://i.stack.imgur.com/DdI7m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DdI7m.png" alt="ALB config"></a></p>
  
  <p>ALB listener + rule
  <a href="https://i.stack.imgur.com/VxtzU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VxtzU.png" alt="enter image description here"></a></p>
  
  <p>My server code</p>
  
  <pre><code>var http = require('http');
  
  var server = http.createServer(function(req, res) {
  fs.readFile('./app.html', 'utf-8', function(error, content) {
      res.writeHead(200, {"Content-Type": "text/html"});
     res.end(content);
  });
  });
  var io = require('socket.io').listen(server);
  server.listen(443);
  </code></pre>
  
  <p>my client code (ios):</p>
  
  <pre><code>NSURL* url = [[NSURL alloc] initWithString:@"https://www.mywebsite.com:443"];
  
  self.socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @YES, @"forcePolling": @YES}];
  
  [self.socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
      NSLog(@"socket connected");
  
  
  }];
  </code></pre>
  
  <p>And finally the error message I'm receiving:</p>
  
  <p>404 Not Found
  The requested URL /socket.io/ was not found on this server.</p>