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://example.com/wp-admin/install.php".
To address this, I modified the configuration by adding the following two lines:
define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');
This adjustment effectively resolves the problem. However, upon completing the WordPress installation process, a new issue arises where the front page consistently redirects to the local IP address 127.0.0.1 even though i have used the domain to access the site. By the way, I have PHPMyAdmin also running within the same container, and the reverse proxy is functioning flawlessly. Therefore, I suspect the issue might be related to the WordPress Docker image.
apache config:
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
RemoteIPHeader CF-Connecting-IP
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/example.com/example.com.pem
SSLCertificateKeyFile /etc/apache2/ssl/example.com/example.com.key
ProxyPass / http://127.0.0.1:8585/
ProxyPassReverse / http://127.0.0.1:8585/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>