How can I make Varnish Cache compatible with redirects?
To ensure full compatibility of GeoIP redirect module with Varnish Cache, you need to change the settings on the web server side.
To change the settings, you have 2 options:
- Contact the hosting provider and tell them what needs to be changed in the web server configuration.
- Change the configuration files yourself (nginx.conf for nginx, .htaccess for apache). To do this, you need to have root access. Restart the server after changing the setting.
For nginx, add the following code anywhere in the nginx.conf file:
For apache, add the following string anywhere in the .htaccess file:
Here, <varnish-ip> is the IP address of the varnish server.