Make WordPress Core

Opened 3 years ago

Closed 23 months ago

#52708 closed defect (bug) (fixed)

Loopback requests do not work on the local development environment

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

Within the local development environment, loopback requests do not work because localhost:8889 does not resolve. This means the following are broken:

  • WP-Cron event spawning
  • Theme editor
  • Plugin editor
  • Multisite network upgrades

The error can be seen on the Site Health screen, by attempting to edit a PHP file with the theme or plugin editor, or by running npm run env:cli cron test. The error is:

cURL error 7: Failed to connect to localhost port 8889: Connection refused

Attachments (2)

52708-loopback-local.diff (291 bytes) - added by sandrasanzdev 2 years ago.
Fix loopback requests on local environment
52708-loopback-local-3.diff (607 bytes) - added by sandrasanzdev 2 years ago.
Enables loopback requests in php (site) and cli (tests) containers.

Download all attachments as: .zip

Change History (11)

#1 @swissspidy
3 years ago

  • Summary changed from Loopback requestss do not work on the local development environment to Loopback requests do not work on the local development environment

@sandrasanzdev
2 years ago

Fix loopback requests on local environment

#2 @sandrasanzdev
2 years ago

  • Keywords has-patch added; needs-patch removed

#3 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.1

#4 @hasanuzzamanshamim
2 years ago

I tested with the provided patch by @sandrasanzdev on my local using

npm run env:cli cron test

But still getting the same issue.

Error: WP-Cron spawn failed with error:
cURL error 7: Failed to connect to localhost port 8889: Connection refused

@sandrasanzdev
2 years ago

Enables loopback requests in php (site) and cli (tests) containers.

#5 @sandrasanzdev
2 years ago

@hasanuzzamanshamim Thanks for testing :) I saw it fixed in the admin panel and forgot to run the test. Uploaded a fix in 52708-loopback-local-3.diff that passes the test too.

This ticket was mentioned in Slack in #core by sandrasanzdev. View the logs.


2 years ago

#7 @hasanuzzamanshamim
2 years ago

Thanks, @sandrasanzdev for the updated patch.
That patch works for me.

#8 @johnbillion
23 months ago

  • Owner set to johnbillion
  • Status changed from new to reviewing

#9 @johnbillion
23 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 53636:

Build/Test Tools: Enable loopback requests to work on the local development environment.

This maps localhost to the host machine so the requests get routed to the web server container.

Props sandrasanzdev, hasanuzzamanshamim

Fixes #52708

Note: See TracTickets for help on using tickets.