[wp-trac] [WordPress Trac] #56347: Download failed. A valid URL was not provided.

WordPress Trac noreply at wordpress.org
Sun Aug 7 23:45:10 UTC 2022


#56347: Download failed. A valid URL was not provided.
-----------------------------+-----------------------------
 Reporter:  unmanarc         |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Upgrade/Install  |    Version:  6.0
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 I found some problem when you configure your wordpress behind an HTTP
 proxy (Without DNS resolution), the plugins/themes/etc updates (not
 talking about 3rd party related) are going to fail with:

 Download failed. A valid URL was not provided.

 I traced back the issue to
 https://github.com/WordPress/WordPress/blob/90e6f5aed5c897f29ef129808d4dc9db29655cd4
 /wp-includes/http.php#L549

 so, the problem is quite simple, when WordPress calls the function
 wp_http_validate_url before calling the proxy itself, WP uses a non-proxy
 DNS function (gethostbyname) to validate the URL hostname, and because I
 don’t have DNS (for security reasons), it will fail…

 the point is, if your internet exit is defined by WP_PROXY_HOST, I would
 not expect to have any other internet access or protocol (like DNS), so
 when you try to resolve downloads.wordpress.org from the WP host (not from
 the proxy), it will fail… but when you ask the http proxy to get some
 content from there, it should work very well…

 using gethostbyname before the http proxy, and dropping the proxy request
 by the gethostbyname failure, was stopping my wordpress from getting
 updates in my secure environment…

 so, understanding this, I did the following temporary hack, I added this
 line to /etc/hosts:

 1.2.3.4 downloads.wordpress.org

 then, when gethostbyname asked for it, the OS libs answered with 1.2.3.4
 (a valid fictitious external IP addr), and passed the request to the proxy
 (who properly handled the download)…

 My recommendation to the developers is to consider that when you have
 configured WP_PROXY_HOST, you should not expect DNS calls to work (try
 another way), DNS should not be a pre-requisite when you have a proxy.

 Regards.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56347>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list