Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#17096 closed defect (bug) (invalid)

WP_HTTP_Proxy :: Host check prevents proxying to local

Reported by: jimmynguyc's profile jimmynguyc Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: HTTP API Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

Blog URL check should be optional by defining them in WP_PROXY_BYPASS_HOSTS.

Forcing this check denies me from proxying my blog URL through 127.0.0.1, which is needed because I'm ProxyPass-ing certain /directories to another server.

E.g.

<VirtualHost *:80>

ServerName mysite.com
ProxyPass /special http://www.mysite.com/special

</VirtualHost>

/special is on a separate server running another CMS. Its IP is hardcoded in the server's hosts file.

Hence,

I will have this in my wp-config.php for the WP http requests to work.

define('WP_PROXY_HOST', '127.0.0.1');
define('WP_PROXY_PORT', '80');
define('WP_PROXY_BYPASS_HOSTS','');

Attachments (1)

17096.diff (412 bytes) - added by jimmynguyc 14 years ago.

Download all attachments as: .zip

Change History (6)

@jimmynguyc
14 years ago

#1 @dd32
13 years ago

  • Keywords 2nd-opinion added

The check here would be to prevent Cron loopback requests from being made via the proxy.. I don't think we can change/remove that.

#2 @jimmynguyc
13 years ago

Well in my case I needed the cron to loopback because resolving the hostname will point the request to another server, as the host file was hardcoded to a different server for the domain name.

As mentioned I needed to do a proxypass of a certain subfolder to a different server, hence the hardcoded IP in /etc/hosts.

It works fine as long as the request came from outside, but if a request came from the server (e.g. a cron task) it will be pointing to a different IP as per defined in /etc/hosts. Meaning that crons jobs will never be executed.

Hence the hack and the WP_HTTP_PROXY workaround which I found is the only way to fix my problem.

Any thoughts?

#3 @dd32
13 years ago

Ultimately, If the IP address of current site is redirected elsewhere, it's not going to end well..

The "common" way to do that would be have the other server named differently eg:

ServerName mysite.com
ProxyPass /special http://www2.mysite.com/special

that way DNS hacking isn't needed.

The Proxy support in core is designed for outgoing requests, rather than loopback requests.

In your case, I'd be filtering outgoing HTTP requests, If it's for the current domain, alter the request to goto http://127.0.0.1/ and force a Host header.. WordPress Beta Tester plugin intercepts connections and rewrites them, you might be able to do something similar.

#4 @jimmynguyc
13 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Thanks I'll give that a try :)

#5 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.