Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by

Hi there,

There is a problem in my Q2A that all users are with the same IP.

The server is nginx . I haven't faced this problem before and users used to have different IPs.

I removed all plugins, but still the problem exists.

Is there any idea?


Q2A version: 1.7.4
are you using cloudfare?
No. We are using Digital ocean DNS Server.

Thanks man.

I was thinking about varnish that I read this post that Scott mentioned: I think you should be turning off Varnish completely for Q2A as it's a dynamic app.


Do you recommend to configure varnish installation ?

1 Answer

+3 votes
selected by
Best answer

Despite my earlier answer, using Varnish is actually not a bad idea because there are a lot of static files within the Q2A folder that Varnish can cache, and I think it will bypass any caching for Q2A due to the headers Q2A outputs.

To solve the problem of everyone having the same IP, you can do it at the server level. This guide for nginx looks good. Change the IP to be whatever your Varnish is.

Alternatively, you can override the qa_remote_ip_address function. See docs here. It would need to be something along the lines of

function qa_remote_ip_address()
    if ($_SERVER['REMOTE_ADDR'] === '') {
        return $_SERVER['HTTP_X_FORWARDED_FOR'];

    return $_SERVER['REMOTE_ADDR'];

Replace '' with your Varnish IP.