---
title: "Discussion on \"Nginx Reverse Proxy for Node.js: A Complete Guide (HTTPS, WebSockets & Docker)\" | Hashnode"
description: "Discussion on \"Nginx Reverse Proxy for Node.js: A Complete Guide (HTTPS, WebSockets & Docker)\". A reverse proxy is one of the most important components in modern web architecture. Whether you're deploying a Node.js API, hosting multiple websites, or running microservices, chances are your applic"
url: "https://hashnode.com/posts/nginx-reverse-proxy-for-node-js-a-complete-guide-https-websockets-docker/6a4b5f53405648147def099f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Nginx Reverse Proxy for Node.js: A Complete Guide (HTTPS, WebSockets & Docker)](https://ayobamiseun.hashnode.dev/nginx-reverse-proxy-for-node-js-a-complete-guide-https-websockets-docker?utm_source=hashnode&utm_medium=feed)

A reverse proxy is one of the most important components in modern web architecture. Whether you're deploying a Node.js API, hosting multiple websites, or running microservices, chances are your applic

Jul 6 · 20 min read · ayobamiseun.hashnode.dev  
Read the article

## Written by

[Adegoke Ayobami Seun](https://hashnode.com/@Ayobamiseun)

@Ayobamiseun · Lagos Nigeria

  
[View profile](https://hashnode.com/@Ayobamiseun)

Software Developer

Hi, I'm Adegoke Ayobami Seun, a software developer.

## Responses 1

Markdown supported · ⌘↵ to post

[CDN Edge Ops](https://hashnode.com/@cdnedgeops)

[Oct 31](https://hashnode.com/posts/nginx-reverse-proxy-for-node-js-a-complete-guide-https-websockets-docker/6a4b5f53405648147def099f/comment/6ae56337e511631306544e6b)

Helpful end-to-end walkthrough. The WebSocket section is where I usually see production surprises after HTTPS is already fine. Upgrade and Connection headers have to land on the location that actually serves the socket path; if a catch-all proxy\_pass sits in front without proxy\_http\_version 1.1 and the upgrade headers, browsers show a vague failure while curl to the HTTP API still looks healthy.

With Docker I also pin proxy\_set\_header Host and X-Forwarded-Proto carefully. Node apps that build absolute URLs from req.protocol will emit http:// links behind TLS termination if they never see X-Forwarded-Proto=https, which then breaks cookies or mixed-content checks. For containers, prefer the service name in upstream and keep the Node process listening on an internal port only — no published 3000 on the host if nginx is the only public entry. One more ops habit: after certbot or a compose recreate, run a quick wscat/browser check on the WS path, not just curl -I on /, because a bad Connection header often survives a successful TLS handshake.
