[wp-trac] [WordPress Trac] #37828: Images linked to Media File on click result in 405 POST requests in customizer

WordPress Trac noreply at wordpress.org
Sat Aug 27 04:16:06 UTC 2016


#37828: Images linked to Media File on click result in 405 POST requests in
customizer
--------------------------+-------------------------
 Reporter:  timph         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.7
Component:  Customize     |     Version:  3.4
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  javascript
--------------------------+-------------------------
Changes (by westonruter):

 * keywords:   => has-patch
 * version:  4.6 => 3.4
 * milestone:  Awaiting Review => 4.7


Comment:

 @timph thanks for the report. You're quite right. The reason for the 405
 (Method Not Allowed) error is that the current customizer uses an HTTP
 `POST` request to pass the customizer state into whatever URL is being
 navigated to. Normally links are to pages served by PHP which accepts
 `POST` requests and so it works as expected. But static files don't accept
 `POST` requests, and so this is why you see an error.

 The fix is simple. We just need to prevent the customizer from attempting
 to follow links to `wp-content` since everything under there should be
 static files (linking directly to PHP files in plugins is an anti-
 pattern). So a solution here is [attachment:37828.0.diff]. Give it a spin.

 Note also that the transactions proposal (#30937) would change the way the
 preview frame works to instead use `GET` requests that include a UUID to
 indicate the customizer state that would have been previously written to
 WP. This would allow for natural URLs (#30028) to be used for the iframe
 window, as opposed to doing the current dance of doing an Ajax `POST`
 request followed by a `document.write()` to an `about:blank` iframe.

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


More information about the wp-trac mailing list