Replies: 2 comments 1 reply
|
I don't know what or why Gemini led me down that path. With some more testing I've found that the default from the sample config works, but only when there is a matching route. Before moving some items over I was testing with what I knew were garbage urls as a quick and easy test assuming it would show the real IP if configured properly, and when it did not that's when I thought my config must be wrong. It's not really fair to you, but with NGINX Proxy Manager being the first reverse proxy most people (me included) use, I made the assumption that other programs would behave the same way and since NPM logs the real ip address for a 404 error I assumed that would be true here as well. |
|
Thanks for following up. Your assumption was reasonable, and your testing found the actual limitation: in v0.31.0,
Please upgrade to v0.31.1 and do this entrypoint:
rules:
not_found: |
{
middleware CloudflareRealIP
}This applies the same trusted Cloudflare real-IP handling before unmatched requests are written to the access log. Keep your existing |
Uh oh!
There was an error while loading. Please reload this page.
v0.31.0
I can not figure out how to get real IP addresses through cloudflare to log. I modify the config.yml using the example from the docs:
middlewares:
- use: cloudflare_real_ip
- use: ModifyResponse
set_headers:
Access-Control-Allow-Headers: ""
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
Access-Control-Allow-Origin: ""
Access-Control-Max-Age: 180
Content-Security-Policy: object-src 'self'; frame-ancestors 'self';
Referrer-Policy: same-origin
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
and the logs set to combined format logs the cloudflare proxy server IP address.
Gemini gave me an alternate option:
middlewares:
- use: real_ip
header: CF-Connecting-IP
from:
- cloudflare
Which logs the error:
errors:
entrypoint error
entrypoint[0]
from > [0]: invalid CIDR address: cloudflare/32
realIP.From: validation error
require "min:1"
Gemini's next response was:
middlewares:
- use: real_ip
header: CF-Connecting-IP
from:
- 0.0.0.0/0
- ::/0
- use: ModifyResponse
This did not work either, and now Gemini says the logs record before middlewares take effect, so ... I don't even know.
All reactions