When behind a corporate firewall, all development tasks become burdened with the efforts of adapting to the restraints imposed from a security minded perspective. Such is the case when accessing a simple site through a node express proxy server when the site is guarded by a corporate firewall.
- Create express proxy server (http://my.example.com)
- On client request, reach a known backend server to pull resources (http://example.com)
- From proxy server, amend and add resources
- Forward amended resources to client browser
Accessing a backend server via an express proxy.
When running the proxy server and making a request to https://my.example.com, the proxy server internally returns the exception:
Error: connect ETIMEDOUT 10.10.10.10:443
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
Additionally, the browser receives the following error (as indicated by using Chrome’s developer tools):
The proxy server must include code that takes into account the corporate proxy server.
By providing in the options to the httpProxy.CreateProxyServer method the correct proxy information in the agent attribute, you can bypass this hurdle and continue churning out stellar code!