Last active
March 17, 2020 15:37
-
-
Save Xvezda/3021e9b61ae165e4403c5930094dbd1d to your computer and use it in GitHub Desktop.
Generate ngx_http_realip_module configration by curl which restore visitor IP from cloudflare ip range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
curl -s --url https://www.cloudflare.com/ips-v4 \ | |
--url https://www.cloudflare.com/ips-v6 \ | |
| xargs -I{} echo 'set_real_ip_from' {}';' \ | |
| sed '$a\'$'\n''real_ip_header CF-Connecting-IP;'$'\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment