Enables the use of Nginx's X-Accel-Redirect header feature for attachment serving.
- 兼容版本:
- 1.4
This permits XenForo to-do validation and authentication, and offload the actual file serving to Nginx. This feature is not particularly well documented, but some info found here.
As XenForo_FileOutput is not easily extensible, this addon reimplements:
- XenForo_ViewAdmin_Attachment_View
- XenForo_ViewPublic_Attachment_View
This addon assumes the /internal_data folder exists within the webroot.
For example, XenForo is accessible from: /forum rather than then the webroot.
The following must be added to config.php:
Something similar to the nginx config may be required in your webserver:代码:config['internalDataUrl'] = '/forum/internal_data';
To ensure you match how XenForo serves files, add the following headers into your site config where appropriate, such as:代码:location ^~ /forum/internal_data { internal; alias /path/to/internal_data; }
代码:location ^~ /forum/internal_data/ { add_header X-Frame-Options SAMEORIGIN; add_header X-Content-Type-Options nosniff; internal; }