Skip to content

Commit

Permalink
skip cf-connecting-ip if it's from a worker
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Aug 28, 2024
1 parent 8b06c91 commit 62911c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plausible_web/remote_ip.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ defmodule PlausibleWeb.RemoteIP do
byte_size(x_plausible_ip) > 0 ->
clean_ip(x_plausible_ip)

byte_size(cf_connecting_ip) > 0 ->
# https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#cf-connecting-ip-in-worker-subrequests
# we don't want to use the Cloudflare Worker IP
byte_size(cf_connecting_ip) > 0 and cf_connecting_ip != "2a06:98c0:3600::103" ->
clean_ip(cf_connecting_ip)

byte_size(b_forwarded_for) > 0 ->
Expand Down

0 comments on commit 62911c5

Please sign in to comment.