1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

XAR - Attachment 附件Redirect 1.0.2

Nginx 附件 Redirect

  1. admin
    兼容版本:
    • 1.4
    Enables the use of Nginx's X-Accel-Redirect header feature for attachment serving.

    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:
    代码:
    config['internalDataUrl'] = '/forum/internal_data';
    Something similar to the nginx config may be required in your webserver:
    代码:
    location ^~ /forum/internal_data {
        internal;
        alias /path/to/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/ {
      add_header X-Frame-Options SAMEORIGIN;
      add_header X-Content-Type-Options nosniff;
      internal;
    }