[BB-4447] Handle 413 Entity Too Large responses when uploading images
This adds handling for 413 Entity Too Large responses when uploading images.
Related Tickets:
Testing
- Apply the following configuration to NGINX (required to avoid CORS errors):
<html><head></head><body>
# internal redirect when request exceeds max_client_body_size
--
error_page 413 = @entity_too_large;
# Add CORS headers, we might be able to trim this
location @entity_too_large {
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
return 413;
}
</body></html>
- Upload a large image (> 1 MB) using any of the console's configuration forms (e.g.
/console/theming/logos
) - Image size is too large error message should display next to control.