Index: src/wp-includes/rest-api.php
===================================================================
--- src/wp-includes/rest-api.php	(revision 40849)
+++ src/wp-includes/rest-api.php	(working copy)
@@ -308,6 +308,7 @@
  * @return string Full URL to the endpoint.
  */
 function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) {
+	global $is_nginx;
 	if ( empty( $path ) ) {
 		$path = '/';
 	}
@@ -324,6 +325,11 @@
 		$url .= '/' . ltrim( $path, '/' );
 	} else {
 		$url = trailingslashit( get_home_url( $blog_id, '', $scheme ) );
+		// nginx only allows HTTP/1.0 methods when redirecting from / to /index.php
+		// To work around this, we manually add index.php to the URL, avoiding the redirect.
+		if ( $is_nginx && 'index.php' !== substr( $url, 9 ) ) {
+			$url .= 'index.php';
+		}
 
 		$path = '/' . ltrim( $path, '/' );
 
Index: tests/phpunit/tests/rest-api.php
===================================================================
--- tests/phpunit/tests/rest-api.php	(revision 40849)
+++ tests/phpunit/tests/rest-api.php	(working copy)
@@ -316,7 +316,18 @@
 		$this->set_permalink_structure( '' );
 		$this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?rest_route=/', get_rest_url() );
 
+		// nginx requires index.php in non-pretty permalinks.
+		global $is_nginx;
+		$is_nginx_backup = $is_nginx;
+		$is_nginx = true;
+
+		$url = get_rest_url();
+
+		$is_nginx = $is_nginx_backup;
+
+		$this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/index.php?rest_route=/', $url );
 	}
+
 	/**
 	 * @ticket 34299
 	 */
