-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@wordpress/env: Loopback requests fail #20569
Comments
I am dealing with the same issue. Wordpress attempts to make a loopback request to its own hostname (not to localhost) on port 443 which fails because the container doesn't provide SSL. If there were a way to force loopback requests to use http instead of https, that might solve the problem, but I haven't found one yet. |
This issue seems to impact WP Cron for me. It looks like the scheduled events can't run because it uses loopback requests to create a background process. I am able to work around this with the // .wp.env.json
"config": {
"ALTERNATE_WP_CRON": true
} |
Two possible solutions to this that I have found are:
For both of the above solutions you will need to change your WP config/settings to accept that domain name instead of the default localhost that wp-env sets. |
I reproduced this at @wordpress/[email protected] in M1 Mac |
@adrianduffell I'm wondering whether you're able to elaborate on your workaround for this a bit more? I've encountered this same issue while working on a plugin I'm developing that registers a custom cron task, and I've attempted to test the cron using the following commands:
This results in this error, whether or not
It would be wonderful if we're able to find a solution for this issue. I've just started using wp-env for the first time and it's a terrific utility. |
This issue also prevents loading editor styles from plugins (or themes if you're not paying attention). For example, I have a plugin that sets up some font files, and it's added to the editor by When the editor styles are loaded, it tries to I had also added the theme's editor styles with |
@noisysocks It looks like this was never resolved and I'm running into this issue. Your solution of editing the |
Yeah, I was referring to making it so that I don't use |
I was having this issue too and one solution that I settled on was to change the default port number from You can either add |
I created a plugin to prevent loopback request errors in WordPress environments that use Docker, such as wp-env. localhost2host-docker-internal Give it a try! |
Thanks @celtislab , I dropped this into my |
Potentially, wp-env could script some changes to the Apache config as described here: docker-library/wordpress#611 (comment) I tried to manually do it but it didn't seem to work
|
I got it to work using _ as the delimiter instead of / ie |
Describe the bug
WordPress isn't able to complete a loopback request when running under
wp-env
.To reproduce
npx wp-env start
There's two errors related to this:
Expected behavior
There should only be one critical error (the one about debug mode.)
Additional context
WordPress is trying to make a request to
http://localhost:8888
from the underlying Docker container but this fails because Apache is listening on port 80. One solution would be to set up thedocker-compose.yml
config to maplocalhost
to the host machine.The text was updated successfully, but these errors were encountered: