Reveal real IP for Nginx behind a reverse proxy

Tools / Tutorials

2020.12.25

Reveal real IP for Nginx behind a reverse proxy

I'm currently using LogDNA for gathering Nginx logs. However, I can only see IPs from Cloudflare by default in the logs as my server was proxied by Cloudflare. Let's see how to reveal the real IP address of the client in the logs behind such reverse proxy server by using ngx_http_realip_module.

Allowing Cloudflare IP addresses only in Nginx

Tutorials / Tools

2020.11.18

Allowing Cloudflare IP addresses only in Nginx

If your HTTP server is running behind Cloudflare, it is recommended to only allow traffic from Cloudflare IP addresses. We can configure this systematically using iptables. However, it's also flexible to white list Cloudflare IPs just inside the Nginx service.

Set up a Firewall with UFW

Tutorials / Linux Notes

2020.08.07

Set up a Firewall with UFW

Uncomplicated Firewall (UFW) is a simplified firewall management interface that hides the complexity of lower-level packet filtering technologies such iptables and uftables.

Homebrew 替换国内镜像源

Tutorials / Tools

2020.05.15

Homebrew 替换国内镜像源

在国内使用 brew 的速度真心不敢恭维,尤其是在 brew update 的时候经常卡住不动。换用 brew update --verbose 你会发现是 git fetch 的速度慢导致的,所以还是要看本地网络连接 GitHub 的速度咯。换个镜像源救救急。

Automatically purge Cloudflare cache after Netlify build

Tutorials / Web Notes

2020.05.15

Automatically purge Cloudflare cache after Netlify build

Although Netlify provides CDN service, Cloudflare has more edge locations around the world. What's more, Netlify hosted sites are hardly reached in China, while Cloudflare still lives. With this in mind, I decided to switch to Cloudflare for load balancing. However, pushing post/file changes to Netlify did not clear Cloudflare's cache, that's a mess. So, I'm going to use Cloudflare's API together with Netlify's outgoing webhook to make them in the same pace.

Ads by Google
Ads by Google