WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/25/2017 12:53:47 AM (3 years ago)
Author:
pento
Message:

REST API: Always add index.php to the REST URL when pretty permalinks are disabled.

When pretty permalinks are disabled, the web server will internally forward requests to index.php. Unfortunately, nginx only forwards HTTP/1.0 methods: PUT, PATCH, and DELETE methods will return a 405 error.

To work around this nginx behaviour, including index.php in the REST URL skips the internal redirect.

Merges 41139 to the 4.8 branch.
Fixes #40886.

Location:
branches/4.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/tests/phpunit/tests/rest-api.php

    r40101 r41140  
    315315        // In non-pretty case, we get a query string to invoke the rest router.
    316316        $this->set_permalink_structure( '' );
    317         $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?rest_route=/', get_rest_url() );
    318 
    319     }
     317        $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/index.php?rest_route=/', get_rest_url() );
     318    }
     319
    320320    /**
    321321     * @ticket 34299
Note: See TracChangeset for help on using the changeset viewer.