The ERR_TOO_MANY_REDIRECTS error usually occurs when there is a redirect loop on the website, which means the website keeps redirecting the user in a loop and never resolves to a final page.
In the case of Varnish and WordPress, this error can occur if the configuration is not set up correctly. Here are a few things you can try to resolve this issue:
- Check the Varnish configuration:
- To optimize the performance of your WordPress site with Varnish caching, it’s essential to ensure that the Varnish configuration file is correctly set up, particularly the backend server configuration. This will ensure that the Varnish server can connect to the backend WordPress server and that the backend server is appropriately configured to handle requests from Varnish. By doing so, you can improve your website’s speed and provide a better user experience.
- Check the WordPress site URL:
- Make sure that the WordPress site URL in the WordPress dashboard is set up correctly. If it is not, WordPress may be redirecting requests to the incorrect URL, causing a redirect loop.
- Check the NGINX configuration:
- Ensure that the NGINX configuration is set up correctly, especially the server block configuration. Make sure that the server block is correctly configured to handle requests from Varnish and to pass them to the backend WordPress server.
- Clear the cache:
- Clear the Varnish cache and any other caches that may be causing the issue. Sometimes, caches can become stale and cause a redirect loop.
- Check for conflicting plugins:
- Some WordPress plugins can conflict with Varnish and cause redirect loops. Try disabling any plugins that may be causing the issue to see if that resolves the problem.
“If you are using WordPress with NGINX + Varnish and still receiving the “ERR_TOO_MANY_REDIRECTS” error, try adding the following code to your wp-config.php file:”
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS'] = 'on';
}
if ( !isset( $_SERVER['HTTPS'] ) ) {
$_SERVER['HTTPS'] = 'on';
}
If you are experiencing server-related issues, please don’t hesitate to contact us at Hitori Tech. Our team is dedicated to resolving any server-related problems that you may be encountering. Simply reach out to us and we will be more than happy to assist you in finding a solution.
For more information or assistance, please visit our contact page and fill out the form with your query or concern. We will get back to you as soon as possible. Thank you for choosing Hitori Tech.