Websoft9 / docker-library

Docker Compose examples of selfhosted FOSS based on official image, just run it.
https://www.websoft9.com
Other
33 stars 17 forks source link

Wordpress Site URL Hardcode Internal_IP for [Wordpress] #436

Closed cerebrux closed 9 months ago

cerebrux commented 9 months ago

Describe the bug

The latest change 40a7880727fc91b4efbd20844c8ed18e35d4027c probably creates a hardcoded "Internal_IP" In Admin panel of wordpress under Site URL.

As a result I am not able to login using my domain name e.g. https://example.com/login. It redirects to

https://internet_ip/wp-login.php

Bug source

System Environment

VPS Ubuntu 22.04 in a lxc container

Application Version

latest docker compose from your

Bug reproduce

Steps to reproduce the behavior:

  1. git clone the repository
  2. edit the .env with your desired settings e.g. changing passwords etc.
  3. docker network create wordpress
  4. docker compose up -d
  5. go to the domain name that you have created A record for the server you run the docker container and complete the wordpress installation (Name, username, password, email etc.)

Once complete login. If successful check in the admin panel the General Settings --> Site URL --> has "https://Internal_URL" string

Check Logs

docker compose logs shows that wordpress-cli runs before the actual wordpress installation is complete.

Screenshot 2023-11-30 125420

Once Wordpress is complete it changes the homeurl and siteurl

Screenshot 2023-11-30 125728

Bug Screenshot

If I open a new browser and go to https://example.com/login it redirects https://internet_ip/wp-login.php

Screenshot 2023-11-30 130030
cerebrux commented 9 months ago

Workaround :

  1. Edit .env
  2. Replce URL=Internal_IP with your actual FQND domain name e.g. URL=example.com
  3. Now after the container is up you will be able to login
chendelin1982 commented 9 months ago

hello, thanks for your suggestion. We have fix it:

  1. W9_URL default is ""
  2. Add below to wp-cli command
      if [ -z \"$W9_URL\" ]; then
        echo 'W9_URL is empty, not need to change, exiting...'
        exit 0
      fi

That mean if you don't modify W9_URL, it have have hardcoded