Open grzesiek1owline opened 3 years ago
Try adding a network alias to the traefik service definition like so:
traefik:
image: traefik:v2.0
container_name: "${PROJECT_NAME}_traefik"
command: --api.insecure=true --providers.docker
ports:
- '8000:80'
# - '8080:8080' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
default:
aliases:
- ${PROJECT_NAME}.${PROJECT_BASE_URL}
For me, this fixed the loopback error and rest api error reported on the "site health" page in wordpress.
@csandanov this is a potential fix for numerous obscure loopback and rest API related issues that have been reported over time here.
Try adding a network alias to the traefik service definition like so:
traefik: image: traefik:v2.0 container_name: "${PROJECT_NAME}_traefik" command: --api.insecure=true --providers.docker ports: - '8000:80' # - '8080:8080' # Dashboard volumes: - /var/run/docker.sock:/var/run/docker.sock networks: default: aliases: - ${PROJECT_NAME}.${PROJECT_BASE_URL}
For me, this fixed the loopback error and rest api error reported on the "site health" page in wordpress.
@csandanov this is a potential fix for numerous obscure loopback and rest API related issues that have been reported over time here.
I think this just ended up breaking things for me... unless I'm doing something wrong, when I add the alias mysite.docker.localhost (and the domain and docker.localhost pointed in my host file to 127.0.0.1 ) I just get a 404. I think because the ailas and main one are competing or something? 🤷 Would love to figure out loopbacks.
@audetcameron indeed that alias seems not to work anymore. At the time I wrote the original post it did solve both the loopback and the rest api errors for me, but now using that alias those errors are back. I get the same errors either with or without the alias now. back to square one.
Codebase
Built-in vanilla WordPress
Host OS
Ubuntu 20.04
Docker info output
I used this a set of docker images to run wordpress on localhost: https://github.com/wodby/docker4wordpress I have a problem with cURL command when i run this tool from php files or from php container. cURL works only when i run it from nginx command line. How to config docker-compose to run cURL and repair wordpress cron. My config:
docker-compose
and traefik docker-compose