Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.5k views
in Q2A Core by
edited by

My q2a server is deployed on a different server, receiving requests from an nginx proxy that is on its own server, so the only client IP that q2a sees is the nginx server's IP.  This results in view counts not incrementing.  The requests that come into q2a could have X-Forwarded-For or X-Real-IP headers, but q2a doesn't use them.

Is there a way to configure this, or places in the code I can start looking to make modifications?

Note: I took a look at this question, but I'm not sure if it applies to my case, since my nginx and q2a servers are on different servers w/ different IPs.  Also, assume it's not an option for me to install nginx on the q2a server to do the client IP rewriting,

Q2A version: 1.6.3
by
edited by
What webserver is your q2a running on ?
by
Hi @maxjtechno, I'm running apache.  The version info is as follows:

Apache/2.2.22 (Debian) PHP/5.4.4-14+deb7u8

2 Answers

+1 vote
by
selected by
 
Best answer
I found a plugin on github that seems to address this.

 

https://github.com/brenard/qa-behind-reverse-proxy-overrides

 

It looks like it just uses an override function to detect the presence of the X-Forwarded-For field and present that as the client IP.
by
This is the one we ended up using, since it's local to Q2A and had the minimum risk to other services.
+1 vote
by
by
Thanks @maxjtechno.  This is the best answer for cases where it's preferred to make the changes to the web server (which is arguably the "right" place for this problem).  In my case though, I'm looking to minimize changes outside of Q2A.
...