1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XAR - Attachment [Deleted]

Discussion in 'Add-on Releases' started by Xon, Dec 30, 2014.

  1. Xon

    Xon Well-Known Member

    Xon submitted a new resource:

    XAR - Attachment - Enables the use of Nginx's X-Accel-Redirect for attachment serving

    Read more about this resource...
  2. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

  3. HWS

    HWS Well-Known Member

    This can actually even proxy the requst to another server. Cool add-on!
    Xon likes this.
  4. RoldanLT

    RoldanLT Well-Known Member

    and the benefits?
  5. Xon

    Xon Well-Known Member

    I'll have a look at that.

    I need to tweak it a bit, as I need to define a "internalDataUri" to properly handle if internal_data isn't in webroot(such as if you are using stream filters). The alias isn't enough.

    XenForo delegates file serving of attachments to nginx, rather than an expensive php worker being tied up for the duration of the entire request.
    RoldanLT likes this.
  6. Xon

    Xon Well-Known Member

    Xon updated XAR - Attachment with a new update entry:

    Support for internal_data being outside the webroot

    Read the rest of this update entry...
    Last edited: Dec 30, 2014
    RoldanLT likes this.
  7. RoldanLT

    RoldanLT Well-Known Member

    This is required on my config.php?
    config['internalDataUrl'] = '/internal_data';
  8. Xon

    Xon Well-Known Member

    Only if you are using php stream filters, or have moved the internal data directory outside the webroot.

    By default, XenForo puts that folder in the webroot and you need to explicitly move it.
    RoldanLT likes this.
  9. RoldanLT

    RoldanLT Well-Known Member

    This I don't understand correctly :)
    No :)
    Just default location.
  10. RoldanLT

    RoldanLT Well-Known Member

    And how can I verify it's working as intended? :)
    I only allow 2mb max filesize attachment upload, Do I still have benefits on this?
  11. Xon

    Xon Well-Known Member

    php stream filters basically let you access some arbitrary URI as if it was a file. It's an advanced technique which has it's uses.

    The easiest way is to check the response headers via your browser debug tools, when viewing an attachment,

    The etag header will be an alphanumeric string rather than a simple integer.

    For example,

    Etag "1419835168"
    Etag "54a0f720-2f90"
  12. RoldanLT

    RoldanLT Well-Known Member

    Working I guess :)

    By the way, after implementing this, my Cpu usage cuts off. Thanks!
  13. Xon

    Xon Well-Known Member

    I don't expect it would be that big a difference, but it depends on how heavily you use attachments.

    How XenForo sends attachments is ok. But it is limited, by the fact that the better solutions are webserver specific.

    For example; @Mr. Goodie2Shoes addon that was linked earlier is vastly more complex than mine. But because downloads are delegated to the webserver, resumable multi-part downloading is provided for free without tying up expensive php processes for each client connection.
  14. Yoskaldyr

    Yoskaldyr Well-Known Member

    D.O.A. and RoldanLT like this.
  15. Xon

    Xon Well-Known Member

    I'm actually planning on going back and cutting out all the redundant header setting which isn't required when using nginx's X-Accel-Redirect header.

    Fundamentally, I'm only planning on supporting nginx and to fall back on the original method the best solution is to disable the addon.

    Wish I found that earlier, would have saved some effort.
    Yoskaldyr and RoldanLT like this.
  16. RoldanLT

    RoldanLT Well-Known Member

    Anybody else using this?
    Doesn't affect uploading new avatar?
  17. Xon

    Xon Well-Known Member

    I'm using it on Spacebattles and Sufficient Velocity as I do sysadmin and addon development for them.

    Works fine there.

    Avatars aren't served through php, so it shouldn't affect them.
    RoldanLT likes this.
  18. D.O.A.

    D.O.A. Well-Known Member

    Yoskaldyr likes this.
  19. Yoskaldyr

    Yoskaldyr Well-Known Member

    Some days ago I've update code for better compatibility with other add-ons. Right now local file path gets from XenForo_FileOutput object (not from settings).
    You can modify your old code like new one from CMF_Core_ViewPublic_Attachment_View (github link to code and to commit)
    D.O.A. likes this.
  20. D.O.A.

    D.O.A. Well-Known Member

    Thanks again, I have 200,000 image attachments it made a difference the day I first installed in 2010. My CPU thanks you!
    Yoskaldyr likes this.

Share This Page