WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 4 weeks ago

#46311 new defect (bug)

Image upload issues in Gutenberg with IIS

Reported by: talldanwp Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

Transferring this Gutenberg github issue here: https://github.com/WordPress/gutenberg/issues/12532

Many users are reporting they're able to upload images using the media uploader, but not in Gutenberg. The common thread seems to be that the server is IIS.

Change History (2)

#1 @joemcgill
2 months ago

  • Milestone changed from Awaiting Review to 5.3

Thanks for getting this moved, @talldanwp. It would be helpful if anyone who is experiencing this issue could copy the full console error here for more debugging. What's interesting is that it only happens in Gutenberg, which leads me to believe it may be something specific to the file upload component which uses the REST API as the back end rather than the traditional admin ajax back-end that is used by the media modal.

#2 @syned
4 weeks ago

Just ran into this issue myself on an IIS server. Here's the response from the console (http://www.example.com/wp-json/wp/v2/media):

<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://www.example.com/wp-json/wp/v2/media/498">here</a></body>
{"id":498,"date":"2019-05-17T10:47:33",.....}

HTML at the top is caused by 302 redirect in class-wp-rest-attachments-controller.php:206.

$response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $id ) ) );

I don't know if there is a way to prevent IIS from outputing this HTML for 302 redirects. I tried just commenting out this line and it fixes the issue, but I'm not sure if it could mess things up somewhere else, so it might not be a good fix.

Note: See TracTickets for help on using tickets.