Description
When the ports are mapped from the container's port 80 to another port wordpress has 2 problems:
"The REST API encountered an error"
"Your site could not complete a loopback request"
This has hindered me in development in certain occasions so I began searching for a workaround besides running it on port 80. I discovered that others have run into the same issue but no real solution. After a bit of digging I discovered that by editing the apache server config files to match the port that was set for the container I could fix the issue.
So in /etc/apache2/sites-enabled/000-default.conf
I added *:8080 to the first line
<VirtualHost *:80 *:8080>
then in /etc/apache2/ports.conf
just below
Listen 80
I added the line
Listen 8080
then after running
apachectl restart
everything now works as expected
I just wanted to mention this as it seems to be an unresolved minor issue that does have a fix… I assume that there would be an automated way to do this in using the docker file but I am not familiar enough with docker to do that.