title: php websocket redirect with stunnel
body: <p>I built a php websocket server javascript clients to connect to it. It's working fine without SSL. My next Step is to improve security with using wss instead of ws (an so enabling https on the website).</p>
  
  <p>My intention is to decrypt incoming traffic and redirect it to the websocketserver using stunnel on CentOS 6.</p>
  
  <p>The first step is to simply redirect the requests from the clients to the server: </p>
  
  <p>client-request: <code>ws://soundjack.eu:9030/wsServer2.php</code></p>
  
  <p>server: socket created listening on <code>144.76.81.210:9090</code> running <code>php -q wsServer2.php</code></p>
  
  <p>coresponding stunnel config:</p>
  
  <pre><code>; Some security enhancements for UNIX systems - comment them out on Win32
  chroot = /var/run/stunnel/
  ;setuid = nobody
  ;setgid = nobody
  ; PID is created inside the chroot jail
  pid = /stunnel.pid
  
  ; Some performance tunings
  socket = l:TCP_NODELAY=1
  socket = r:TCP_NODELAY=1
  ;compression = zlib
  
  ; Some debugging stuff useful for troubleshooting
  debug = 7
  output = /var/log/stunnel/stunnel.log
  
  ; Use it for client mode
  client = yes
  
  ; Service-level configuration
  [wsServer]
  accept = 127.0.0.1:9030
  connect = 127.0.0.1:9090
  </code></pre>
  
  <p>stunnel starts correct and is listening to port 9030.</p>
  
  <p>Every request that is sendet by a client gehts abortet (checked firebug console). On Chrome it says status: finished, without any further information. </p>
  
  <p>I quite don't know what the error is, so any help would be great. Thanks!</p>