Attachment Improvements By Xon

Attachment Improvements By Xon 2.6.7

No permission to download
Using DigitalOcean Spaces or Amazon S3 for file storage in XF 2.x.

Additional configuration is required to enable X-Accel-Redirect when using DigitalOcean Spaces or Amazon S3

A internalDataUrl stanza l must be added to config.php like the externalDataUrl described in the tutorial

PHP:
$config['internalDataUrl'] = function($externalPath, $canonical)
{
    return 'internal_data_s3/..../internal_data/' . $externalPath;
};
nginx config must be updated with a new internal_data_s3 block;
PHP:
location ~* /internal_data_s3/(.*?)://(.*?)/(.*) { 
    internal; 
    set $xfEtag $upstream_http_etag; 
    set $download_protocol $1; 
    set $download_host $2; 
    set $download_path $3; 
    set $download_url $download_protocol://$download_host/$download_path; 
 
    resolver 127.0.0.1 ipv6=off; 
    proxy_set_header Host $download_host; 
    proxy_set_header Authorization ''; 
    proxy_set_header Cookie ''; 
    proxy_max_temp_file_size 0; 
    proxy_intercept_errors on; 
    error_page 301 302 307 = @handle_redirect; 
 
    proxy_pass $download_url$is_args$args; 
 
    proxy_hide_header Content-Disposition; 
    proxy_hide_header Content-Type; 
    proxy_hide_header Etag; 
    proxy_hide_header x-amz-request-id; 
 
    add_header Etag $xfEtag; 
    add_header X-Frame-Options SAMEORIGIN; 
    add_header X-Content-Type-Options nosniff; 
} 

location @handle_redirect {
   resolver 127.0.0.1 ipv6=off;
   set $saved_redirect_location '$upstream_http_location';
   proxy_pass $saved_redirect_location;
}

To implement proxy caching see https://www.nginx.com/resources/wiki/start/topics/examples/reverseproxycachingexample/
  • Add missing option phrases for the image attachment extension list. option
  • Fix incorrectly using svg url for thumbnail
  • Like
Reactions: MattW
  • Repackage installer to ensure leftover development bits are fully removed
Back
Top Bottom