[wp-trac] [WordPress Trac] #31200: wp_redirect Missing Body - Causes Performance Issues

WordPress Trac noreply at wordpress.org
Sun Feb 1 18:56:17 UTC 2015


#31200: wp_redirect Missing Body - Causes Performance Issues
--------------------------+-----------------------------
 Reporter:  tripsis       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.1
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+-----------------------------
 When I changed my site over to a new setup using nginx and Varnish, I
 noticed some performance issues when doing things like submitting a
 comment, activating plugins, etc.

 I narrowed it down to a problem with wp_redirect not providing a body, and
 thus nginx does not provide a content length. This causes Varnish to hang,
 waiting for a body, until it hits a time out (which by default is 5
 seconds). This makes any action that involves a redirect take a minimum of
 5 seconds (or whatever the time out is set to).

 Adding some output to wp_redirect immediately solved the problem for me.

 Even though this may relate to a specific nginx/Varnish setup, the HTTP
 standards also say you should always include some kind of output in the
 body. Nginx + php-fpm does not do this by default, and given that this is
 an increasingly common stack it would be useful if it conformed to
 standards.

 The issue can also be sidestepped by adding:


 {{{
 header( "Content-Length: 0" );
 }}}


 However, this does not conform to RFC specs.

 See: http://www.ietf.org/rfc/rfc2616.txt under 10.3.2 and 10.3.3

 HTTP 301:
    The new permanent URI SHOULD be given by the Location field in the
    response. Unless the request method was HEAD, the entity of the
    response SHOULD contain a short hypertext note with a hyperlink to
    the new URI(s).
 HTTP 302:
    The temporary URI SHOULD be given by the Location field in the
    response. Unless the request method was HEAD, the entity of the
    response SHOULD contain a short hypertext note with a hyperlink to
    the new URI(s).

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


More information about the wp-trac mailing list