Repository navigation
v2.51.0
๐ Cloudflare ํ๋ก์ ๋ค์์ ๊ตญ๊ฐ ์ฐจ๋จ์ด ์ค์๋ํ๋ ๋ฌธ์
Cloudflare ํ๋ก์(์ค๋ ์ง ํด๋ผ์ฐ๋)๋ ๋ค๋ฅธ CDNยท๋ฆฌ๋ฒ์ค ํ๋ก์๋ฅผ NPG ์์ ๋๋ฉด, ์ ์์์ IP๊ฐ ์๋๋ผ ๊ทธ ํ๋ก์์ IP๊ฐ ๊ธฐ๋ก๋์ต๋๋ค. ๊ตญ๊ฐ ์ฐจ๋จ์ ์ผ ๋์ จ๋ค๋ฉด Cloudflare ์๋ฒ์ ๊ตญ๊ฐ๋ก ํ์ ๋์ด ์ ์ ๋ฐฉ๋ฌธ์๊ฐ ๋งํ์ต๋๋ค.
์์ธ์ NPG๊ฐ ์ ๋ขฐํ ํ๋ก์ ๋ชฉ๋ก์ ์ฌ์ค๋ง ์ฃผ์๋ก๋ง ๊ณ ์ ํด ๋๊ณ , ๋๋ฆด ๋ฐฉ๋ฒ์ ์ ๊ณตํ์ง ์์๊ธฐ ๋๋ฌธ์ ๋๋ค.
์ค์ โ ์ ๋ขฐ ํ๋ก์
๋ชฉ๋ก์ ์ง์ ์ง์ ํ์ค ์ ์์ต๋๋ค.
- Cloudflare ํ๋ฆฌ์ โ ์ฒดํฌ ํ ๋ฒ์ผ๋ก Cloudflare๊ฐ ๊ณต๊ฐํ ๋์ญ 22๊ฐ๊ฐ ๋ค์ด๊ฐ๋๋ค.
- ์ง์ ์ ๋ ฅ โ ๋ค๋ฅธ CDN์ด๋ ์ฌ๋ฌด์ค ํ๋ก์ ๋ฑ์ IPยทCIDR๋ก ์ถ๊ฐํฉ๋๋ค.
- ์ค์ IP ํค๋ โ ๊ธฐ๋ณธ๊ฐ์ ์ง๊ธ๊น์ง์ ๊ฐ์
X-Forwarded-For์ ๋๋ค.
Cloudflare Tunnel๋ง ์ฐ๊ณ ๊ณ์๋ค๋ฉด ์ด ์ค์ ์ ํ์ ์์ต๋๋ค. ํฐ๋์ ์ด๋ฏธ ์ค์ IP๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ฌ๋ฉ๋๋ค. ํ๋ก์ ๋ชจ๋๋ก NPG๋ฅผ ์ง์ ๋ ธ์ถํ์ ๊ฒฝ์ฐ์๋ง ํด๋น๋ฉ๋๋ค.
โ ๏ธ ํค๋๋ฅผ ๋ฐ๊พธ์ค ๋ ์ฃผ์ํ ์
CF-Connecting-IP ๊ฐ์ ํค๋๋ก ๋ฐ๊พธ๋ฉด, ๊ทธ ํค๋๊ฐ ์๋ ์์ฒญ์ ์ค์ IP๋ฅผ ์ ์ ์๊ฒ ๋ฉ๋๋ค. NPG ์์ ๊ณต์ ๊ธฐ๋ ๋ค๋ฅธ ํ๋ก์(HAProxy, ์๋๋ก์ง, ๋ ๋ค๋ฅธ nginx ๋ฑ)๋ ํจ๊ป ์๋ค๋ฉด ๊ทธ์ชฝ ํธ๋ํฝ์ด ์ฌ์ค IP๋ก ๊ธฐ๋ก๋์ด ๊ตญ๊ฐ ์ฐจ๋จ์ ์ ๋ถ ๊ฑธ๋ฆด ์ ์์ต๋๋ค. Cloudflare๋ง ์์ ์๋ ๊ฒฝ์ฐ์๋ง ๋ฐ๊ฟ ์ฃผ์ธ์. ํ๋ฉด์๋ ๊ฐ์ ๊ฒฝ๊ณ ๋ฅผ ๋์๋๋ค.
์์ ์ฅ์น
์ ๋ขฐ ๋ฒ์๋ฅผ ๋๊ฒ ์ก์ผ๋ฉด ๋ฐฉ๋ฌธ์๊ฐ ์๊ธฐ IP๋ฅผ ๋ง์๋๋ก ์์ฅํ ์ ์๊ณ , ๊ทธ๋ฌ๋ฉด ๊ตญ๊ฐ ์ฐจ๋จยท์ ๊ทผ ๋ชฉ๋กยทIP ์ฐจ๋จยทfail2banยท์์ฒญ ์ ์ ํ์ด ํ๊บผ๋ฒ์ ๋ฌด๋ ฅํ๋ฉ๋๋ค. ๊ทธ๋์ ๋ชฉ๋ก์ด ๊ฐ๋นํ๋ ์ ์ฒด ์ฃผ์ ๊ฐ์์ ์ํ์ ๋๊ณ , ์ด๊ณผํ๋ฉด ์ด์ ์ ํจ๊ป ๊ฑฐ์ ํฉ๋๋ค. 0.0.0.0/0 ๊ฐ์ ๊ฐ์ ๋ฌผ๋ก ์ด๊ณ , /8 ๋์ญ 256๊ฐ๋ฅผ ๋์ดํด ์ธํฐ๋ท ์ ์ฒด๋ฅผ ์ ๋ขฐ์ํค๋ ์ฐํ๋ ๋งํ๋๋ค.
์ฌ์ค๋งยท๋ฃจํ๋ฐฑ ๋์ญ์ ํญ์ ์ ๋ขฐํ๋ฉฐ ์ ๊ฑฐํ ์ ์์ต๋๋ค. ๋์ปค ๋ด๋ถ ํต์ ๊ณผ LAN ํ๋ก์๊ฐ ์ฌ๊ธฐ์ ์์กดํฉ๋๋ค. ๋ด๋ถ ํ๋ก์๊ฐ 10.0.0.0/8 ๊ฐ์ ์ฌ์ค ๋์ญ์ ์๋ค๋ฉด ์ง์ ์
๋ ฅ์ ๋ฃ์ผ์
๋ ๋ฉ๋๋ค โ ์ธํฐ๋ท์์ ๋ณด๋ผ ์ ์๋ ์ฃผ์๋ผ ์ ์ํ์ ๊ฑธ๋ฆฌ์ง ์์ต๋๋ค.
์ด ์ค์ ์ ๊ฑด๋๋ฆฌ์ง ์์ผ์๋ฉด ๋์์ด ์ ํ ๋ฌ๋ผ์ง์ง ์์ต๋๋ค. ์์ฑ๋๋ nginx ์ค์ ์ด ์ด์ ๊ณผ ๋ฐ์ดํธ ๋จ์๋ก ๋์ผํฉ๋๋ค.
์ ๋ขฐ ํ๋ก์๋ฅผ ์ผ์ ๋ค์๋ ์ฐจ๋จ IP ๋ชฉ๋ก์ ํ ๋ฒ ํ์ธํด ์ฃผ์ธ์. ์ด ๋ฌธ์ ๋ฅผ ์ฐํํ๋ ค๊ณ Cloudflare ์๋ฒ ์ฃผ์๋ฅผ ์ ๋ขฐ IP๋ ์ฐจ๋จ ๋ชฉ๋ก์ ๋ฃ์ด ๋์ จ๋ค๋ฉด, ์ด์ ๊ทธ ์ฃผ์๋ก ๋ค์ด์ค๋ ์์ฒญ์ด ์์ผ๋ฏ๋ก ํด๋น ํญ๋ชฉ์ ์๋ฏธ๊ฐ ์์ด์ง๋๋ค.
์ด๋ฆ์ด ๋น์ทํ ๋ค๋ฅธ ์ค์ ๊ณผ ํท๊ฐ๋ฆฌ์ง ์๋๋ก โ ์ด ํ๋ฉด์ ํ๋ก์๋ ํธ๋ํฝ(GeoIPยท์ ๊ทผ ๋ชฉ๋กยท์ฐจ๋จ IPยทfail2banยท์์ฒญ ์ ํ)์ ์ ์ฉ๋ฉ๋๋ค. NPG ๊ด๋ฆฌ ํ๋ฉด ์์ฒด์ ๋ก๊ทธ์ธ ์ ๊ธ๊ณผ API ํ ํฐ IP ์ ํ์ ์ฐ์ด๋
TRUSTED_PROXY_CIDRํ๊ฒฝ๋ณ์์๋ ๋ณ๊ฐ์ ๋๋ค.
๐ข ๋ก๊ทธ ๋ทฐ์ด์์ ์ํ ์ฝ๋๋ฅผ ์ง์ ์ ๋ ฅํ ์ ์์ต๋๋ค
์ํ ์ฝ๋ ํํฐ๊ฐ 17๊ฐ ๊ณ ์ ๋ฒํผ๋ฟ์ด๋ผ, nginx๊ฐ ์ค์ ๋ก ๋จ๊ธฐ๋ 499๋ 444๋ ์์ ๊ณ ๋ฅผ ์ ์์์ต๋๋ค.
์ด์ ์ธ ๊ฐ์ง ๋ฐฉ๋ฒ์ ํจ๊ป ์ฐ์ค ์ ์์ต๋๋ค.
- ๋ถ๋ฅ ์ ํ โ
2xx,4xx๊ฐ์ ๋จ์๋ก ํ ๋ฒ์ - ์์ฃผ ์ฐ๋ ์ฝ๋ โ ๋ฒํผ์ผ๋ก ๋ฐ๋ก
- ์ง์ ์
๋ ฅ โ
499,444,4xx๋ฑ ๋ฌด์์ด๋ . ์ผํ๋ก ์ฌ๋ฌ ๊ฐ๋ฅผ ๋ถ์ฌ ๋ฃ์ด๋ ๋ฉ๋๋ค
์ ์ธ ํํฐ์๋ ์ํ ์ฝ๋๊ฐ ์ถ๊ฐ๋์ต๋๋ค. ์ง๊ธ๊น์ง IPยทUser-AgentยทURIยทํธ์คํธยท๊ตญ๊ฐ๋ง ์ ์ธํ ์ ์์๋๋ฐ, ์ด์ 200์ด๋ 3xx๋ฅผ ๋นผ๊ณ ๋ณด์ค ์ ์์ต๋๋ค.
์คํ๋ ์ ์ฅ ์์ ์ ์๋ ค ๋๋ฆฝ๋๋ค. ์์ ์๋ ์๋ชป๋ ๊ฐ์ด ์กฐ์ฉํ ๋ฌด์๋์ด, ํํฐ๊ฐ ๊ฑธ๋ฆฐ ๊ฒ์ฒ๋ผ ๋ณด์ด์ง๋ง ์ค์ ๋ก๋ ์ ์ฒด ๋ชฉ๋ก์ด ๋์ค๋ ์ํ๊ฐ ๋์ต๋๋ค.
์ค๋ฅ ๋ก๊ทธ๋ ์ํ ์ฝ๋๊ฐ ์์ผ๋ฏ๋ก ์ฝ๋๋ฅผ ์ ์ธํ์ ๋ ๊ณ์ ํ์๋ฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ WAF์ ์ฐจ๋จ๋ ์์ฒญ์ 403์ด๋ฏ๋ก, 403์ ์ ์ธํ๋ฉด ํจ๊ป ์จ๊ฒจ์ง๋๋ค.
์ธ ๊ฐ์ง๋ฅผ ์ ๋ฆฌํด ์ ์ํด ์ฃผ์ @iamxail ๋ ๊ฐ์ฌํฉ๋๋ค. (#278)
๐ช IP ์ง์ ์ ์ ์ฐจ๋จ(444)์ด ์ค์ ๋ก 444๋ฅผ ๋๋ ค์ค๋๋ค
์ค์ โ IP ์ง์ ์ ์ ์ฒ๋ฆฌ๋ฅผ "์ฐ๊ฒฐ ์ข ๋ฃ(444)"๋ก ๋์ จ๋๋ฐ๋ ๋ก๊ทธ์ 400์ด ์์ฌ ๋ณด์ด๋ ๋ฌธ์ ์ ๋๋ค.
๊ฐ์ฅ ๋ง์๋ ์์ธ์ HTTPS ํฌํธ๋ก ๋ค์ด์จ ํ๋ฌธ HTTP์
๋๋ค. ๋ธ๋ผ์ฐ์ ๋ ์ค์บ๋๊ฐ https ํฌํธ์ http๋ก ๋ถ๋ ๊ฒฝ์ฐ์ธ๋ฐ, nginx๊ฐ ์ด๊ฑธ ๋ณธ๋ฌธ ์ฒ๋ฆฌ ๋จ๊ณ ์ด์ ์ ๋๋ด ๋ฒ๋ ค์ ์ค์ ํด ๋์ 444 ๊ท์น์ด ์คํ๋ ๊ธฐํ์กฐ์ฐจ ์์์ต๋๋ค. ํ ์ค์น ๊ธฐ์ค **์ผ์ฃผ์ผ 400๊ฑด ์ค 52%**๊ฐ ์ด ๊ฒฝ์ฐ์์ต๋๋ค.
์ด์ ์ด๋ฐ ์์ฒญ๋ ๋๊ฐ์ด ์ฐ๊ฒฐ์ ๋์ต๋๋ค.
์๋์ ์ผ๋ก ๋ฐ๊พธ์ง ์์ ๊ฒ๋ค
- ์์ฒญ ์์ฒด๊ฐ ๊นจ์ง ๊ฒฝ์ฐ๋ ๊ณ์ 400์ ๋๋ค. ์์ฒญ ๋ผ์ธ์ด ๊นจ์ก๊ฑฐ๋ Host ํค๋๊ฐ ์์ผ๋ฉด nginx๋ Host๋ฅผ ์ฝ๊ธฐ๋ ์ ์ ๊ฑฐ์ ํ๋ฏ๋ก, ์ด๋ ์ฐ๊ฒฐ์ ๋์ด ๋ฒ๋ฆฌ๋ฉด ์ค์ ๋ก ๋ฑ๋กํ์ ๋๋ฉ์ธ์ผ๋ก ์จ ์์ฒญ๊น์ง ์๋ฆฌ ์์ด ๋๊ธฐ๊ฒ ๋ฉ๋๋ค. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฒ๊ทธ๋ก ์๋ชป๋ ์์ฒญ์ ๋ณด๋ด๋ ์ ์ ํด๋ผ์ด์ธํธ๊ฐ ์์ธ์ ์ ์ ์๊ฒ ๋๋ฏ๋ก, ์ง๋จ ๊ฐ๋ฅํ 400์ ๋จ๊ฒจ ๋์์ต๋๋ค. ์ด๋ฐ ์์ฒญ์ ๋๋ถ๋ถ ์ค์บ๋ ๋ ธ์ด์ฆ์ด๊ณ ๋ก๊ทธ์๋ ๊ทธ๋๋ก ๋ณด์ ๋๋ค
- "403 ๋ฐํ"์ผ๋ก ๋์ ๊ฒฝ์ฐ๋ ๊ทธ๋๋ก์ ๋๋ค. ํ๋กํ ์ฝ ์ฐ๋ ๊ธฐ์๊น์ง 10KB์ง๋ฆฌ ์๋ด ํ์ด์ง๋ฅผ ๋๋ ค์ฃผ๋ฉด ์๋ต์ด ์์ฒญ์ 70๋ฐฐ๊ฐ ๋์ด ๋ฐ์ฌ ๊ณต๊ฒฉ์ ์ ์ฉ๋ ์ ์์ต๋๋ค
- "์ฐ์ปด ํ์ด์ง ํ์"๋ ๊ทธ๋๋ก์ ๋๋ค โ ์๋ฌด๊ฒ๋ ๋ง์ง ์๊ธฐ๋ก ํ์ ์ค์ ์ด๋ฏ๋ก nginx ๊ธฐ๋ณธ ๋์์ ์ ์งํฉ๋๋ค
๋ํ HTTPS๋ก IP ์ง์ ์ ์์ TLS ๋จ๊ณ์์ ๊ฑฐ๋ถ๋๋ฏ๋ก ์ ์ด์ HTTP ์ํ ์ฝ๋๊ฐ ๋จ์ง ์์ต๋๋ค. ๋ก๊ทธ์ ์๋ฌด๊ฒ๋ ์ ๋ณด์ด๋ ๊ฒ์ด ์ ์์ ๋๋ค. ์ด ๋ด์ฉ์ ์ค์ ํ๋ฉด ์๋ด์๋ ์ ์ด ๋์์ต๋๋ค.
๋ก๊ทธ๋ฅผ ๊ผผ๊ผผํ ํ์ธํด ์๋ ค ์ฃผ์ @re-birkin ๋ ๊ฐ์ฌํฉ๋๋ค. (#280)
๐ ๊นจ์ง ์์ฒญ์ด ๋ก๊ทธ์ ์๋ชป ๊ธฐ๋ก๋๋ ๋ฌธ์
ํ์์ด ๊นจ์ง ์์ฒญ(์ค์บ๋๊ฐ ๋ณด๋ธ ๋นHTTP ๋ฐ์ดํธ ๋ฑ)์ ๋ก๊ทธ๋ฅผ ํด์ํ ๋ ์์ฒญ ๋ฉ์๋ ์๋ฆฌ์ ์๋ฑํ ๊ฐ์ด ๋ค์ด๊ฐ๊ณ , ํธ์คํธ ์ ๋ณด๊ฐ ์ฌ๋ผ์ง๋ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค. ์ผ์ฃผ์ผ์ 161๊ฑด ์ ๋์์ต๋๋ค.
ํธ์คํธ๊ฐ ์ฌ๋ผ์ง๋ ์ชฝ์ด ๋ ์ค์ํฉ๋๋ค โ fail2ban์ ์์ฒญ์ด ์ด๋ ํธ์คํธ ๊ฒ์ธ์ง ์์์ผ ์คํจ๋ก ์ ๋๋ค. ์ด์ ์ ํํ ๊ธฐ๋ก๋ฉ๋๋ค.
๐ข ์ต์คํ๋ก์ ์ฐจ๋จ ๊ท์น ์ ๋ ฅ ๊ฒ์ฆ
๊ท์น์ ๋ง๋ค ๋ pattern_type(ํจํด์ ์ ์ฉํ ์์น)์ ์ง์ํ์ง ์๋ ๊ฐ์ ๋ฃ์ด๋ ์ ์ฅ์ด ๋์ต๋๋ค. ๊ทธ๋ฐ๋ฐ ์ด ๊ฐ์ผ๋ก nginx ์ค์ ์ด ๋ถ๊ธฐํ๊ธฐ ๋๋ฌธ์, ๊ท์น ๋ชฉ๋ก์๋ "ํ์ฑ"์ผ๋ก ๋ณด์ด์ง๋ง ์ค์ ๋ก๋ ์๋ฌด๊ฒ๋ ์ฐจ๋จํ์ง ์๋ ์ํ๊ฐ ๋์ต๋๋ค.
severity๋ ์๋ฌด ๋ฌธ์์ด์ด๋ ์ ์ฅ๋์ต๋๋ค. ์ด์ ๋ ๋ค ์ ์ฅ ์์ ์ ๊ฑฐ์ ํ๊ณ ํ์ฉ๊ฐ์ ์๋ ค ๋๋ฆฝ๋๋ค. ๊ท์น ์์ ๊ฒฝ๋ก์๋ ๊ฒ์ฆ์ด ์์ ์์๋๋ฐ, ์ฌ๊ธฐ์๋ ์ถ๊ฐํ์ต๋๋ค(์๋ชป๋ ์ ๊ท์ ํฌํจ).
API ๋ช ์ธ(swagger)๋ ์ค์ ๋์๊ณผ ๋ง์ง ์์ ๋ค์ ์์ฑํ์ต๋๋ค โ ํ์ ํ๋๊ฐ ๋น ์ ธ ์์๊ณ , ์กด์ฌํ์ง ์๋ ํ๋๊ฐ ๋ฌธ์์ ์์์ต๋๋ค.
์ฌํ ์ ์ฐจ๊น์ง ์ ๋ฆฌํด ์ฃผ์ @four2mis ๋ ๊ฐ์ฌํฉ๋๋ค. (#279)
๐งน ํจ๊ป ๊ณ ์น ๊ธฐ์กด ๋ฌธ์ ๋ค
์ด๋ฒ ๊ธฐ๋ฅ์ ๊ฒ์ฆํ๋ค ๋๋ฌ๋, ์ด์ ๋ถํฐ ์๋ ๋ฌธ์ ๋ค์ ๋๋ค.
- ์ฒซ ์ค์น ์งํ ์์คํ ๋ก๊ทธ๊ฐ ์์ง๋์ง ์์์ต๋๋ค. ์ค์ ํ๋ฉด๊ณผ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ "์ผ์ง"์ด๋ผ๊ณ ํ์ํ๋๋ฐ, ์ต์ด ๋ถํ ์ธ์ ์์๋ง ์ค์ ๋ก๋ ๊บผ์ง ์ฑ๋ก ๋์ํด ๋ค์ ์์ํ๊ธฐ ์ ๊น์ง ๋ก๊ทธ๊ฐ ํ๋๋ ์์ด์ง ์์์ต๋๋ค.
- ์ปจํ
์ด๋๋ณ ๋ก๊ทธ ๋ ๋ฒจ ๊ธฐ๋ณธ๊ฐ์ด ์ ์ปจํ
์ด๋ ์ด๋ฆ์ ์ฐ๊ณ ์์์ต๋๋ค. ๊ทธ๋์ ์๋ก ์ค์นํ๋ฉด ๋ฐ์ดํฐ๋ฒ ์ด์ค์ UI ์ปจํ
์ด๋๊ฐ ์๋ํ
warn์ด ์๋๋ผinfo๋ก ๋์ํ์ต๋๋ค. ์ง์ ๋ฐ๊พธ์ ์ค์ ์ ๊ทธ๋๋ก ๋๊ณ , ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก์ธ ๊ฒฝ์ฐ๋ง ์ ์ ํฉ๋๋ค. - ๋ก๊ทธ๋ฅผ ์ค๋๋ ์์ผ๋ก ์ ๋ ฌํ๋ฉด ๋ค์ ํ์ด์ง๊ฐ ๋์ด๊ฐ์ง ์์์ต๋๋ค. API๋ฅผ ์ง์ ์ฐ์๋ ๊ฒฝ์ฐ ๊ฐ์ ํ์ด์ง๊ฐ ๋ฌดํํ ๋ฐ๋ณต๋์ต๋๋ค.
apiยทui ์ด๋ฏธ์ง๋ฅผ ๋ชจ๋ ๋ฐ์ ๋ค์ ์ฌ๋ ค ์ฃผ์ธ์.
docker compose pull && docker compose up -d
๐ Country blocking misfired behind a Cloudflare proxy
With Cloudflare's proxy (orange cloud) โ or any CDN or reverse proxy โ in front of NPG, the address recorded for a request was the proxy's, not the visitor's. With country restriction enabled, requests were judged by Cloudflare's country and legitimate visitors were blocked.
The cause: NPG's list of proxies to trust for real-IP extraction was hardcoded to private networks, with no way to extend it.
Settings โ Trusted Proxies
You can now name the proxies you trust.
- Cloudflare preset โ one click adds Cloudflare's 22 published ranges.
- Custom entries โ any other CDN or office proxy, as IPs or CIDRs.
- Real IP header โ defaults to
X-Forwarded-For, exactly as before.
Not needed for Cloudflare Tunnel โ a tunnel already delivers the real client address. This only affects proxy mode pointing at a publicly reachable NPG.
โ ๏ธ Before changing the header
Selecting something like CF-Connecting-IP means requests that do not carry it keep the proxy's address. If anything else also sits in front of NPG (a router, HAProxy, a NAS, another nginx), that traffic is recorded with a private address and a country whitelist can block all of it. Change it only when Cloudflare is the only thing in front. The screen carries the same warning.
Guard rails
Trusting too broadly lets visitors forge their own address, which defeats country restriction, access lists, banned IPs, fail2ban and rate limiting at the same time. The list is therefore capped by the total number of addresses it covers, and anything over answers with the reason. That rejects 0.0.0.0/0, and also the workaround of listing 256 separate /8 blocks to trust the whole internet.
Private and loopback ranges are always trusted and cannot be removed โ Docker's own traffic and LAN proxies depend on them. If your internal proxy lives in one (10.0.0.0/8 and friends), you can list it explicitly too: an internet client cannot send from those, so they do not count against the cap.
Leaving the setting alone changes nothing. The generated nginx configuration is byte-identical to before.
After enabling trusted proxies, review your Banned IPs. If you worked around this by adding Cloudflare edge addresses to trusted or banned lists, those entries no longer match anything.
Not to be confused with the similarly named setting โ this screen governs proxied traffic (GeoIP, access lists, banned IPs, fail2ban, rate limiting). The
TRUSTED_PROXY_CIDRenvironment variable is separate and governs NPG's own admin panel: login lockout and API-token IP restrictions.
๐ข Type any status code in the log viewer
The status filter offered 17 fixed buttons, so codes nginx actually logs โ 499, 444 โ could not be selected at all.
Three ways to filter now:
- By class โ
2xx,4xxand so on, in one click - Common codes โ still one click
- Free entry โ
499,444,4xx, anything; comma-separated lists paste in fine
Status codes can now be excluded too. Exclusion covered IPs, user agents, URIs, hosts and countries; you can now hide 200 or all 3xx.
Typos are reported when you apply them. Previously a bad value was silently ignored, leaving a view that looked filtered and was not.
Error-log rows have no status code and stay visible when codes are excluded. Note that WAF-blocked requests are 403, so excluding 403 hides them too.
๐ช Direct IP blocking (444) now actually returns 444
With Settings โ Direct IP Access set to "Close Connection (444)", some requests were still logged as 400.
The biggest cause was cleartext HTTP sent to the HTTPS port โ a browser or scanner speaking http to your https port. nginx finalizes that before the content phase, so the 444 rule never got a chance to run. It was 52% of a week's 400s on one install.
Those now close the connection like everything else.
What deliberately did not change
- A genuinely malformed request still answers 400. When the request line is broken or the Host header is missing, nginx rejects it before reading the Host โ so closing the connection there would silently drop malformed requests aimed at a hostname you have configured, leaving a client with a buggy HTTP library no way to diagnose it. These are mostly scanner noise and remain visible in the log
- "Return 403" is untouched. Answering protocol garbage with the 10KB access-denied page makes the reply over 70x the request โ a reflection surface not worth opening
- "Show welcome page" is untouched โ you asked for nothing to be blocked, so nginx's own behaviour stands
Also worth knowing: direct IP access over HTTPS is refused during the TLS handshake, so no HTTP status is ever recorded. Seeing nothing in the log is the expected outcome. The settings screen now says so.
Thanks to @re-birkin for reading the logs closely. (#280)
๐ Malformed requests were recorded incorrectly
When parsing the log line for a malformed request โ a scanner's non-HTTP bytes, for instance โ the request method came out as a stray value and the host was lost. About 161 rows a week.
The lost host is the part that matters: fail2ban only counts a failure it can attribute to a host. Both are now recorded correctly.
๐ข Exploit rule input is validated
Creating a rule with an unsupported pattern_type (where the pattern is applied) saved successfully โ but the nginx configuration branches on that value, so the rule appeared enabled in the list while blocking nothing.
severity accepted any string too. Both are now rejected at save time with the accepted values named. The rule update path had no validation at all; it does now, including the regex.
The API specification was out of sync with the implementation and has been rewritten โ a required field was missing, and fields that do not exist were documented.
๐งน Pre-existing problems fixed along the way
Surfaced while verifying the features above.
- System logs were not collected right after a first install. The settings screen and the database both said "on", but the first boot session ran with collection off, so nothing was recorded until the next restart.
- Per-container log level defaults named the old container names, so a new install ran the database and UI containers at
infoinstead of the intendedwarn. Settings you changed yourself are left alone; only untouched defaults are corrected. - Sorting logs oldest-first never advanced past the first page for API clients following the pagination cursor.
Pull both the api and ui images and restart.
docker compose pull && docker compose up -d
Docker Images
docker pull svrforum/nginxproxyguard-api:2.51.0
docker pull svrforum/nginxproxyguard-ui:2.51.0
docker pull svrforum/nginxproxyguard-nginx:2.51.0Architectures: linux/amd64, linux/arm64
| Component | Status |
|---|---|
| API | Built |
| UI | Built |
| Nginx | Skipped (no changes) |
Contributors: @app/dependabot