Added if test for !res.headersSent around res.writeHeaders method call on line 678 in gateway.js to prevent "headers sent" uncaught exceptions, i.e. when 504 timeout error response is already sent.
Merge pull request #19 from JohnWMay/master

Added if test for !res.headersSent around res.writeHeaders method call o...