[wp-trac] [WordPress Trac] #16858: Usage of HTTP_HOST in the administration

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 29 21:09:12 UTC 2011


#16858: Usage of HTTP_HOST in the administration
-----------------------------------------+------------------------------
 Reporter:  amirhabibi                   |       Owner:
     Type:  defect (bug)                 |      Status:  reopened
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Administration               |     Version:  3.1
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+------------------------------

Comment (by techgurufloyd):

 My server is behind a couple of reverse proxies - one sends it to the
 chache, the other to the app server farm when the cache doesn't have the
 request. HTTP_HOST will never be accurate in that environment. Shouldn't
 WordPress use SERVER_NAME instead? Or perhaps offer an option to use
 SERVER_NAME or HTTP_X_FORWARDED_HOST instead of HTTP_HOST? There's also
 the option of using the server name I put in the WP options.

 The ugly hack I'm using in wp-config right now to get around this:

 {{{
 //UGLY HACK:
 $_SERVER['HTTP_HOST_ORIG'] = $_SERVER['HTTP_HOST']; //Might as well keep
 it around, but whatever.
 $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'];    //The important part.
 }}}


 Would WordPress be open to some kind of configuration option that selects
 which Header to use? If so, I can generate a patch that replaces every
 instance of HTTP_HOST with something that uses such an option.

 Another idea would be to set {{{$_SERVER['WP_HOST']}}} to be whichever
 header is chosen, and do a quick sed to change HTTP_HOST to WP_HOST. That
 still feels hackish, but it would work. Whatever solution is chosen, I'm
 looking for something that gets in the core.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16858#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list