Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kozakana
Last active June 5, 2022 15:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kozakana/5661c3bfeb1f6030535469d8067ddf85 to your computer and use it in GitHub Desktop.
Save kozakana/5661c3bfeb1f6030535469d8067ddf85 to your computer and use it in GitHub Desktop.
CloudFrontのIPアドレスを取得してnginxのset_real_ip_fromの形式で出力
curl -s "https://ip-ranges.amazonaws.com/ip-ranges.json" |jq -r '.prefixes | map(select(.service == "CLOUDFRONT").ip_prefix) | "set_real_ip_from" + " " + .[] + ";"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment