[wp-trac] [WordPress Trac] #39586: Handle absolute request URI-s

WordPress Trac noreply at wordpress.org
Tue Jan 17 04:07:39 UTC 2017


#39586: Handle absolute request URI-s
-------------------------------------+------------------------------
 Reporter:  szepe.viktor             |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Rewrite Rules            |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  close reporter-feedback  |     Focuses:
-------------------------------------+------------------------------

Comment (by rmccue):

 Per @dd32's note, it depends on your server here, but Apache/nginx
 _should_ be correctly passing the URL in and handling the URL parsing
 correctly here.

 By "What exactly in WordPress would need to handle this?", I meant more,
 "what exactly is breaking in WordPress?". Evidently something in
 `$_SERVER` is set incorrectly, but the question is "what"? :) (My guess is
 `REQUEST_URI`)

 Replying to [comment:7 szepe.viktor]:
 > We need to mention that browsers usually send only relative URI-s.
 ''Actually it took me 2 weeks to find out that it is valid to send an
 absolute URI.''

 Actually, technically speaking, it is not. Servers are split into two
 types in HTTP: proxy servers, and origin servers. The absolute form is
 only used for proxy servers, but Apache/nginx act as origin servers, so
 the client is acting in an invalid way.

 Specifically, per [https://tools.ietf.org/html/rfc7230#section-5.3
 RFC7230, §5.3]:
 > When making a request directly to an origin server, other than a
 > CONNECT or server-wide OPTIONS request (as detailed below), a client
 > MUST send only the absolute path and query components of the target
 > URI as the request-target.

 The RFC also says "all HTTP/1.1 servers MUST accept the absoluteURI form
 in requests, even though HTTP/1.1 clients will only generate them in
 requests to proxies." As far as I can tell, Apache/nginx should be
 converting this to the relative form before passing to PHP, but it appears
 it's not.

 I suspect this is probably a misconfiguration at the server level
 (Apache/nginx), but seeing as we can fix it on our end, we may as well.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39586#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list