Attachments load indefinitely on confluence page
Asked by Sanjay Chinthala:

Hi Team,

* We are not able to preview the excel files from wiki page and it loading indefinitely. The expected behavior should be that either the preview loads, or the file downloads. This does not happen, the page is disabled, and you have to refresh it to continue.
* Right Clicking on the attachment and clicking on the open link in new tab initiates the download.

Please look into why the download doesn't start when you just click on the attachment.

anonymous user can preview the files to public space when we using confluence URL but it is not working using the wiki site

The version we are using :

**confluence 6.13**

Thanks,

Sanjay


Answers:
author: Sanjay Chinthala
body: Hi Shannon ,

We are facing the preview issue

Notice that they load indefinitely. The expected behavior should be that either the preview loads, or the file downloads. This does not happen, the page is disabled, and you have to refresh it to continue.

Right Clicking on the attachment and clicking on the open link in new tab initiates the download.

Please look into why the download doesn't start when you just click on the attachment.  
Collapse

**logs:**

0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"  
45.127.57.234 - - - - - \[04/Mar/2019:00:45:50 -0500\] "POST /rest/webResources/1.0/resources HTTP/1.1" 403 1561 54 " "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"

Thanks,

Sanjay

comments: author: Shannon S
body: Sanjay,

From what I can tell from your last response, is that you are running the same Confluence instance on two URLs. Please be advised that this is not recommended and is likely what is causing the issues on your instance.

In that case, the article you mentioned earlier without context is indeed the article you want to have a look at.

* [Cross Site Request Forgery CSRF Protection Changes in Atlassian REST](https://confluence.atlassian.com/kb/cross-site-request-forgery-csrf-protection-changes-in-atlassian-rest-779294918.html)

You can whitelist domains per this article:

* [Configuring the Whitelist](https://confluence.atlassian.com/doc/configuring-the-whitelist-381255821.html)

For your redirect, I would recommend a 301 permanent redirect, so that you're not serving Confluence from two separate URLs. An example is available here:

* [How to Create Temporary and Permanent Redirects with NGINX](https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-nginx)

Let me know if you have any questions.

Regards,

Shannon


author: Sanjay Chinthala
body: Thanks, Shannon and it's working now :)


author: Shannon S
body: Great news, Sanjay!

Take care, and have a pleasant rest of your week.

Regards,

Shannon


author: Shannon S
body: Sanjay,

Would you be able to tell us what error messages are occurring in the Confluence server logs when the attachments don't load?

Are you running behind a firewall or proxy?

You may also want to take a look at the results in Developer Tools in your browser.

Regards,

Shannon

comments: author: Sanjay Chinthala
body: I am using Nginx proxy for redirection and as per documentation other domains are blocked

<https://confluence.atlassian.com/kb/cross-site-request-forgery-csrf-protection-changes-in-atlassian-rest-779294918.html?_ga=2.118777997.524992768.1550060009-1015810751.1550060009>

can you help me to add trusted domains


author: Shannon S
body: Sanjay,

Are you sharing that article because it includes the error message you found in your logs? I'm not sure how it is related, but I wouldn't think that the issue is due to the attachment being on a trusted domain.

My assumption is that your attachments are hosted on the same server as your Confluence instance, so it should already be trusted. Are you somehow hosting your attachments on an external server?

Does the issue occur for all kinds of attachments, or only Excel files?

Another thing you could do is generate a HAR file and then have a look at it to see what is having trouble loading:

* [Generating HAR files and analyzing web requests](https://confluence.atlassian.com/kb/generating-har-files-and-analyzing-web-requests-720420612.html)

You can use a [HAR Viewer](http://www.softwareishard.com/har/viewer/) once you've generated that in order to read the file.

Regards,

Shannon