docker-library / docker-library/docs

Add documentation for fix for loopback problem when port is mapped

Open
#2,262 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
5.3k
Forks
2.2k
Avg merge
1d 18h
Merged PRs (30d)
11

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the workaround described for /etc/apache2/sites-enabled/000-default.conf and /etc/apache2/ports.conf, including the added port and the apachectl restart command. Document how Docker port mapping causes the WordPress loopback and REST API errors and how this workaround resolves them; done means the fix is clear and reproducible for users.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, docker, wordpress
Domain
devops, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.