WordPress official docker container image causing redirects when not on port 80
-
I have a site I’ve been running for ages in a VM on various providers. I decided to move it to using Containers. To first make sure things were going to work, I set it up with port 80 exposed. Everything worked great.
Then I changed it to a different port. (I’ve tried 8008, 8081, etc)
I know it’s not a firewall issue because on the VM I’m running the container on, there is no firewall.
When I do a curl, I get a redirect:
curl -v localhost:8008 * Trying ::1:8008... * connect to ::1 port 8008 failed: Connection refused * Trying 127.0.0.1:8008... * Connected to localhost (127.0.0.1) port 8008 (#0) > GET / HTTP/1.1 > Host: localhost:8008 > User-Agent: curl/7.69.1 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 301 Moved Permanently < Date: Sat, 17 Oct 2020 18:51:57 GMT < Server: Apache/2.4.38 (Debian) < X-Powered-By: PHP/7.4.11 < X-Redirect-By: WordPress < Location: https://localhost/ < Content-Length: 0 < Content-Type: text/html; charset=UTF-8 < * Connection #0 to host localhost left intact
I find this odd because the container should be seeing the request as coming from 80, should it not?
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64ad07efd4da docker.io/library/mariadb:10.5 mysqld 22 minutes ago Up 22 minutes ago 0.0.0.0:8008->80/tcp, 0.0.0.0:8443->443/tcp, 0.0.0.0:8082->8080/tcp wordpress_db b71a5cf0c0dc k8s.gcr.io/pause:3.2 22 minutes ago Up 22 minutes ago 0.0.0.0:8008->80/tcp, 0.0.0.0:8443->443/tcp, 0.0.0.0:8082->8080/tcp 979ae13e34da-infra e52178bc560e docker.io/library/wordpress:latest apache2-foregroun... 22 minutes ago Up 22 minutes ago 0.0.0.0:8008->80/tcp, 0.0.0.0:8443->443/tcp, 0.0.0.0:8082->8080/tcp wordpress
I looked at a few different Docker posts here, but none seemed to match this. Maybe people did the initial set up their WordPress blogs on that other port? I know when I ran this on a computer in my homelab, I can run a fresh WP install on another port in a Docker container and it works just fine.
Eventually the goal is to have nginx in front of all of this and parceling off port 80 requests to different containers based on the domain name coming in. So I would need WordPress to be OK with being on another port so that I can pass it on.
Thanks!!
- The topic ‘WordPress official docker container image causing redirects when not on port 80’ is closed to new replies.