-
Hello, I have this snippet of a custom script:
The output is Here is my nginx config. It only proxies netbox:
I've played around with my nginx config but cannot figure out how to get the correct client_ip address and not nginx IP address. Im assuming nginx is the issue... Any input is much appreciated! Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
just to update: i tried this nginx config:
with this python code:
The log output says: 😞 |
Beta Was this translation helpful? Give feedback.
-
The simplest thing to do is just copy what the sample nginx.conf supplied with Netbox does. You can use tcpdump to see what Nginx is sending to Netbox, and hence what it's putting in the X-Forwarded-For header.
However I note:
This shouldn't be necessary, unless you have another reverse proxy upstream from Netbox's Nginx; this means to trust the value provided in the incoming X-Forwarded-For header, if the request comes from one of those IPs. See realip docs. I think all you need is
although there may be some mangling if IPv6 addresses are used. See nginx docs |
Beta Was this translation helpful? Give feedback.
-
@candlerb I've done as you suggested. Copied the exact config from the docs, and added
You can see my whole tcpdump here: https://pastebin.com/CZPfdyKh From the dump i can see nginx sets the variables correctly (lines Thanks again |
Beta Was this translation helpful? Give feedback.
-
OK, so you can see Perhaps you can log |
Beta Was this translation helpful? Give feedback.
-
unfortunately no 😞
Thank you for that input. So my script.py looks now like this:
Which gave me this log output
|
Beta Was this translation helpful? Give feedback.
-
Your first link didnt work but i fixed here Thank you for the input!! I think i have an idea of what to do |
Beta Was this translation helpful? Give feedback.
@candlerb
Your first link didnt work but i fixed here
Thank you for the input!!
I think i have an idea of what to do