WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 2 weeks ago

#46311 new defect (bug)

Image upload issues in Gutenberg with IIS

Reported by: talldanwp Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-patch
Focuses: Cc:
PR Number:

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 (3)

#1 @joemcgill
6 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
5 months 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.

#3 @desrosj
2 weeks ago

  • Keywords needs-patch added
  • Milestone changed from 5.3 to Future Release

Unfortunately, without a working understanding of this issue or a patch, this one needs to be punted.

If someone can debug and provide a working patch before 5.3 RC1, it can be considered for a move back to 5.3.

Note: See TracTickets for help on using tickets.