Question

Load balancer proxy protocol with Express.js Node app

Anyone got a DO Load Balancer w/ Proxy Protocol to work with a Droplet running a Express.js website/API? As soon as I turn on proxy protocol, the LB droplet status goes unhealthy. I’ve tried adding app.set('trust proxy', true); to my Express setup as per docs (https://expressjs.com/en/guide/behind-proxies.html) but no luck.

I really don’t want to run NGINX or Apache in-front of my Dockerized Node app.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It looks like the http, https, or http2 package you are using from Node internals need wrapped with something like this fork https://github.com/cusspvz/proxywrap. I have yet to test, but this seems promising.

I found the answer - just use the https://www.npmjs.com/package/proxywrap package.

This comment has been deleted