XAR - Attachment [Deleted]

To ensure you match how XenForo serves files, add the following headers into your site config where appropriate:
Code:
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;


Seems
Code:
add_header X-Frame-Options SAMEORIGIN;
Is not needed since it's default on XenForo or else it will result duplicate header?
 
Seems
Code:
add_header X-Frame-Options SAMEORIGIN;
Is not needed since it's default on XenForo or else it will result duplicate header?
IIRC my testing showed that nginx stripped that header on the internal redirect.
 
To ensure you match how XenForo serves files, add the following headers into your site config where appropriate
So how did you add it?
On what location?
I just add it on top of my server block.
Below server_name.
 
So how did you add it?
On what location?
I just add it on top of my server block.
Below server_name.
Ah, yes that would cause duplicates. It can also cause issues with attachments sorry.

I've got this code block:
Code:
  location ^~ /internal_data/ {
  add_header X-Frame-Options SAMEORIGIN;
  add_header X-Content-Type-Options nosniff;
  internal;
  }

The internal directive means it can only be accessed via internal redirects, and the "^~" means this only matches things which start with that path, and it should be before any php, or image handling blocks.

I've updated the initial documentation with that.
 
Here's what I have right now:
Code:
location /internal_data {
        location ~ \.(data|html|php)$ {
        internal;
        }
    internal;
    }
So I will change it to:
Code:
location /internal_data {
        location ~ \.(data|html|php)$ {  
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
        internal;
        }
    internal;
    }

Right?
 
Is there any reason why this doesn't work when XenForo is in a folder, and not the document root?

Code:
        location /forum/ {
                try_files $uri $uri/ /forum/index.php?$uri&$args;
                location /forum/internal_data {
                        location ~ \.(data|html|php)$ {
                                add_header X-Frame-Options SAMEORIGIN;
                                add_header X-Content-Type-Options nosniff;
                                internal;
                        }
                        internal;
                }
                location /forum/library {
                        location ~ \.(default|html|php|txt|xml)$ {
                                internal;
                        }
                        internal;
                }
        }

All attachments return 404 not found when enabled.
 
  • Like
Reactions: Xon
Is there any reason why this doesn't work when XenForo is in a folder, and not the document root?
Can you try adding the following to your config.php:
Code:
config['internalDataUrl'] = '/forum/internal_data';

What is suspect is happening is the disk-layout doesn't match the URL layout.
 
Can you try adding the following to your config.php:
Code:
config['internalDataUrl'] = '/forum/internal_data';

What is suspect is happening is the disk-layout doesn't match the URL layout.
Perfect!
 
  • Like
Reactions: Xon
I have [bd] Attachment Store and Xar up and running as of today. Haven't really done a thorough investigation on what the performance upgrade is. Not sure which one is the biggest improvement on performance. I have 54k of attachments on my site.
 
@Xon, I don't fully understand all the technical details, but is there a way to also benefit from the XAR addon when [bd] Attachment Store is installed?
 
@Xon, I don't fully understand all the technical details, but is there a way to also benefit from the XAR addon when [bd] Attachment Store is installed?
The XAR addon addon simply isn't needed if [bd] Attachment Store is installed, and set to a non-default storage option.

Keep in mind; that the non-default storage options in [bd] Attachment Store removes the ability to permission check attachments.
 
@Xon, I use the default storage option :) I run a minimal setup of 2Core, 2Gb Memory and 40Gb SSD from DigitalOcean.
Don't think the permission checks are really important on my forum. 99,9% of the pictures are about Maine Coons (cat breed) :P

Thanks for your replies!
 
  • Like
Reactions: Xon
Top Bottom