Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

X-Forwarded-For ignored #20

Open
guruevi opened this issue Feb 6, 2015 · 2 comments
Open

X-Forwarded-For ignored #20

guruevi opened this issue Feb 6, 2015 · 2 comments

Comments

@guruevi
Copy link

guruevi commented Feb 6, 2015

When munkiwebadmin is hidden behind a proxy (eg. nginx or Apache), in the admin view all the computers have as address 127.0.0.1 (or whatever the proxy address is). This seems to be caused by /munkiwebadmin/reports/views.py line 61 using machine.remote_ip = request.META['REMOTE_ADDR'].

According to this documentation: http://www.djangobook.com/en/2.0/chapter17.html a piece of middleware should be able to 'fix' that transparently, alternatively an if/then can be used to check whether certain proxy headers are set. When X-Forwarded-For is set, the first IP should be used as the client IP (remote_addr).

@gregneagle
Copy link
Contributor

I'd say that's outside the core of MunkiWebAdmin, then - there are all sorts of Django customizations someone running MWA might make.

If you have a fix that could be included in the MWA code (and not break people without this setup) I'd be happy to consider a pull request.

@natewalck
Copy link
Contributor

I agree with Greg.

I had this same issue and ended up tweaking the Django settings so it looked at X-Forwarded-For instead of the REMOTE_ADDR.

I can't remember if I had to change the actual MWA code or if this was just a setting in the main project settings.py.

Perhaps it could be argued that if it isn't in settings.py, it should be exposed in such a way so that one does not need to change the core MWA code to get the desired behavior.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants