WordPress Redirects to IP Address Instead of Domain
Hello everyone, I'm currently in the process of setting up WordPress using Docker Compose and Apache which is running on the host as a reverse proxy (unfortunately, I can't use nginx). Additionally, I use Cloudflare. When I attempt to access the site using the domain, I encounter an immediate redirect to "https://127.0.0.1:8585/wp-admin/install.php" instead of the desired "https://domain.com/wp-admin/install.php". To address this, I modified the configuration by adding the following two lines:
define('WP_HOME','https://domain.com');
define('WP_SITEURL','https://domain.com');
This adjustment successfully resolves the issue, but I'm uncertain whether this is the optimal approach. I would greatly appreciate any assistance or guidance on whether this method is appropriate, or if there's an alternative solution that can be implemented through Docker Compose environment variables. Thank you for your insights.
Edit: Unfortunately, when attempting to proceed with the above settings, I encountered again an issue. After completing the WordPress setup and attempting to access the main page of the WordPress site using the domain, I was redirected again to the IP address "https://127.0.0.1/". Is there anyone who has a solution for this problem?
Did you try to change the env file there is ${IP} defined so you simply change it to Domain name etc.
Same
Please try some of the solutions mentioned here.
Have you tried disabling some of the plugins, especially those that are related to caching?
Hello, It might be problem with Nginx / Firewall config problem not with Wordpress by itself.
Yes it was problem with Nginx it occurred when force ssl has been enabled.