Add localhost prefix support to detect-dev-staging-domain.php

Support General Add localhost prefix support to detect-dev-staging-domain.php

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #48637
    Infolu OfficialInfolu Official
    Participant

    Hi,
    I’d like to suggest including the "localhost" prefix in the list of development domains inside the detect-dev-staging-domain.php https://github.com/wpmetabox/library/blob/master/composer/composer.json file. This would help automatically detect local environments (e.g., http://localhost, http://localhost:8000) and avoid incorrect environment assumptions during local development.

    Several applications and development environments use "localhost" as a prefix. Some examples include:
    XAMPP, MAMP, WAMP, LAMPP
    Laravel (with php artisan serve)
    Symfony (built-in server)
    Flask
    Django
    Node.js (with tools like Vite, React, Angular, Vue CLI)
    Webpack Dev Server, Parcel
    Docker (ports mapped to localhost)
    DDEV, Lando, DevKinsta, LocalWP
    Testing tools like Cypress and Selenium

    For this reason, it is common and recommended to treat "localhost" as a development domain.
    I suggest adding support for the localhost prefix in the detect-dev-staging-domain.php file to help properly detect local environments.

    *.localhost

    Thanks!

    #48649
    PeterPeter
    Moderator

    Hello,

    Thank you for your feedback.

    We will add the localhost prefix/suffix to the file to detect the local site. Let me know if you have any questions.

    #48660
    Anh TranAnh Tran
    Keymaster

    Hi,

    "localhost" is always treated as dev domain (note, we verify by domain, not port, so "localhost" will work for all hosts like "localhost:8080", etc.). You can see the source code here.

    We also added ".localhost" suffix so all domains *.localhost will be treated as dev domains.

    #48666
    Infolu OfficialInfolu Official
    Participant

    Hai Anh Tran thanks for the information, I was thinking when I saw this counting on the dashboard and sites.

    exemplo

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.