Can't download attachements from self hosted bitwarden

we have a new self hosted instalation of bitwarden. Everything is working exept for downloading of attachments. Uploading and deleting attachments work.

When we click on attachement to download it just spins, when looking at dev console in browser i can see that its actually trying to access http://localhost:4000/attachments//xxxxxxxxxxxxxxxx to download it. Looks like url rewrite is failing on nginx that comes with the bitwarden install. We do not have other proxies.
./bwdata/env/global.override.env
./bwdata/config.yml

both have correct url configured.

where else can this be configured?

I’m having the same issue with a new self-hosted instance through a custom domain (not localhost). I don’t see any instances of localhost in global.override.env or config.yaml

Bitwarden version:
Status: Image is up to date for bitwarden/setup:1.41.3
docker.io/bitwarden/setup:1.41.3

When I try to download the attachment, the request is to:

domain/api/ciphers/…/attachment/…

and the response json is:
{“Object”:“attachment”,“Id”:“long id here”,“Url”:“http://localhost:4000/attachments//long key here”,“FileName”:“2.”,“Size”:“8327857”,“SizeName”:“7.94 MB”}

my case is solved. In my case i had to add the following to the global.override.env file:

globalSettings__attachment__baseDirectory=/etc/bitwarden/core/attachments
globalSettings__attachment__baseUrl=https://YOURDOMAINHERE/attachments
globalSettings__send__baseDirectory=/etc/bitwarden/core/attachments/send
globalSettings__send__baseUrl=https://YOURDOMAINHERE/attachments/send

2 Likes

I’m getting the same issues with attachments & send self hosted.
Tried what @donatas recommended, but i don’t have a /etc/bitwarden/core/attachments directory
However updating baseURL got me a little closer

I can see attachments and send files being uploaded to:
Attachments with out the a
/opt/bitwarden/bwdata/core/attchments$ ls
5091fd3f-e951-4031-bb03-ad410061afa6

Ant this is the link the web page is trying to get to:
https://mydomain/attachments/5091fd3f-e951-4031-bb03-ad410061afa6/6n7uzhzmgeswm25fgtcheazu33ni7h92

Tried setting globalSettings__attachment__baseDirectory to the location above, but no luck.
Any thoughts?

HI did You manage to resolve this issue , I have this and really do not know why I am still getting 404

Where can I check the functions and parameter details of these environment variables?
I want to modify Bitwarden’s defaults time zone, but I don’t know how to set it. Bitwarden defaults UTC time is used, which results in times in emails always needing to be converted to a time zone.

My current version is 2023.12.0. It is possible to follow @donatas method. In addition, if the port you use is not 443, you need to change it to the correct port.

For those who run into this issue, I found out my problem was that I have BitWarden running on a completely different port than 80 or 443.

Make sure you alter globalSettings__baseServiceUri__vault= in global.override.env to include the port number at the end if you are operating this way.

For some reason, mine defaulted to the base url without the specific port added on. This resulted in failed downloads of attachments.

So globalSettings__baseServiceUri__vault=https://myvault.mydomain.tld:PORT

I didn’t require any of the other override mentioned above after this was fixed.

One year later and my own fix came back to help me. Not sure how my env variable got changed, but the same fix worked.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.