Downloading attachment from confluence URL

My application uses rest calls to get the download URL of an attachment in confluence documents page. The problem is if user is logged in to confluence, downloading works fine other wise it redirects to login page.

<a href="https://example.com/download/attachments/{id}/MyFile.txt" download></a>

It downloads login.htm if user is not logged in to confluence.

1 answer

Hi Faisal!

This is expected behavior.  By default Confluence does not allow anonymous access.

If you'd like to enable anonymous access, you can, by browsing to, (as a site admin), (Cog Icon) -> Global Permissions -> Anonymous Access.

This is clearly not ideal from a security standpoint, but it should work for what you're trying to do.

Thanks!

Hi Cody!

Thank you for your valuable response. As you mentioned its not ideal from a security standpoint, we also can't allow anonymous access as the documents are intellectual property. While user is logged in,  I've observed that confluence takes a JSESSIONID cookie in request headers when the download URL is accessed directly from browser and it works fine.

Can you suggest something which enables me to do the same in my application. I am using C# and javascript to make the calls.

Thanking in anticipation!

Hey Faisal!  Sadly that is well beyond my level of expertise...  I'll ask around and see if I can get any information for ya, but I'm personally not sure.  sad

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,943 views 27 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you