Can't add an image (Attachment or background) #225

Closed
opened 2026-02-04 17:55:55 +03:00 by OVERLORD · 14 comments
Owner

Originally created by @FreeSst on GitHub (Sep 1, 2022).

When I try to add an image it redirects me to the login page.

Planka installed with Docker Compose through Portainer. Changes in yml only here:

...
ports:
- 3358:1337
environment:
- BASE_URL=https://planka.mydomain.com
...

Redirect by

/etc/nginx/conf.d/planka.mydomain.com.d/redirect.conf
location / {
  proxy_pass        http://127.0.0.1:3358;
  proxy_redirect    off;
  proxy_set_header  Host $host;
  proxy_set_header  X-Real-IP $remote_addr;
  proxy_set_header  X-Forwarded-Proto $scheme;
  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header  X-Forwarded-Host $server_name;
  proxy_set_header  X-Forwarded-Port $server_port;
  
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
}

In browser console I see this:

planka_error

Originally created by @FreeSst on GitHub (Sep 1, 2022). When I try to add an image it redirects me to the login page. Planka installed with Docker Compose through Portainer. Changes in yml only here: ``` ... ports: - 3358:1337 environment: - BASE_URL=https://planka.mydomain.com ... ``` Redirect by ``` /etc/nginx/conf.d/planka.mydomain.com.d/redirect.conf ``` ``` location / { proxy_pass http://127.0.0.1:3358; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Port $server_port; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } ``` In browser console I see this: ![planka_error](https://user-images.githubusercontent.com/6725426/187905294-21aac8ed-e786-4ade-82ac-9479fd387d46.png)
Author
Owner

@FreeSst commented on GitHub (Sep 2, 2022):

Seems that this is the same problem as described here:
https://github.com/plankanban/planka/issues/189

If I use IP without https all works
BASE_URL=http://serverip:3358

Workaround for Apache is described there. But all my experiments with Nginx have had no luck.

@FreeSst commented on GitHub (Sep 2, 2022): Seems that this is the same problem as described here: https://github.com/plankanban/planka/issues/189 If I use IP without https all works BASE_URL=http://serverip:3358 Workaround for Apache is described there. But all my experiments with Nginx have had no luck.
Author
Owner

@meltyshev commented on GitHub (Sep 2, 2022):

I hope that someday I will make a documentation with installation and working configs 🙈

@meltyshev commented on GitHub (Sep 2, 2022): I hope that someday I will make a documentation with installation and working configs 🙈
Author
Owner

@FreeSst commented on GitHub (Sep 3, 2022):

After a while, changed a lot of options in configs and spent a lot of time.
I have uploaded some images when connected by IP. After I changed setting to a domain, and I can see the uploaded images. But I can't upload it through the domain at all.
Error:
POST https://planka.mydomain.com/api/projects/795141969448797479/background-image [HTTP/2 401 Unauthorized 299ms]

@FreeSst commented on GitHub (Sep 3, 2022): After a while, changed a lot of options in configs and spent a lot of time. I have uploaded some images when connected by IP. After I changed setting to a domain, and I can see the uploaded images. But I can't upload it through the domain at all. Error: `POST https://planka.mydomain.com/api/projects/795141969448797479/background-image [HTTP/2 401 Unauthorized 299ms]`
Author
Owner

@meltyshev commented on GitHub (Sep 3, 2022):

It looks like Authorization header is missing because of the CORS settings 🤔
What if you try to set allowOrigins: '*' in the server/config/security.js (just for the test).

@meltyshev commented on GitHub (Sep 3, 2022): It looks like Authorization header is missing because of the CORS settings 🤔 What if you try to set `allowOrigins: '*'` in the `server/config/security.js` (just for the test).
Author
Owner

@FreeSst commented on GitHub (Sep 4, 2022):

Did not help :(
At this time we have:

  1. http://IP:port - can upload images, but I don't see them;
  2. https://planka.domain.com - I can't upload images, but I see uploaded by IP images
@FreeSst commented on GitHub (Sep 4, 2022): Did not help :( At this time we have: 1. http://IP:port - can upload images, but I don't see them; 2. https://planka.domain.com - I can't upload images, but I see uploaded by IP images
Author
Owner

@gr0vity-dev commented on GitHub (Sep 16, 2022):

I had a similar problem that attachments would not load. (However my real issue was that I had a traling / in my base Url and images could not be found under //attachements)

This is my nginx config that works for me :

server {
    server_name planka.mydomain.com ;

    location / {
      proxy_buffering off;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://127.0.0.1:3202;
    }



    listen 80; # managed by Certbot

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/planka.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/planka.mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
@gr0vity-dev commented on GitHub (Sep 16, 2022): I had a similar problem that attachments would not load. (However my real issue was that I had a traling / in my base Url and images could not be found under //attachements) This is my nginx config that works for me : ``` server { server_name planka.mydomain.com ; location / { proxy_buffering off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:3202; } listen 80; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/planka.mydomain.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/planka.mydomain.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } ```
Author
Owner

@Giorgio-Germani commented on GitHub (Mar 3, 2023):

It would be great if someone could write a configuration for Nginx Proxy Manager. Everything besides the image upload works. I don't what the issue is.

image
image

The circle just keeps going whenever i try to upload something.
image

@Giorgio-Germani commented on GitHub (Mar 3, 2023): It would be great if someone could write a configuration for Nginx Proxy Manager. Everything besides the image upload works. I don't what the issue is. ![image](https://user-images.githubusercontent.com/104979449/222750147-87ff5cb6-80f4-44ee-b9cc-6a8c13dd947c.png) ![image](https://user-images.githubusercontent.com/104979449/222750243-3d6cb5ae-c1f4-436b-a1af-3a0d44e8a76f.png) The circle just keeps going whenever i try to upload something. ![image](https://user-images.githubusercontent.com/104979449/222750864-0ae637e7-43cf-4c4a-81c2-c4d5e8a791d7.png)
Author
Owner

@daniel-hiller commented on GitHub (Mar 3, 2023):

Hi,
the config should work fine.
We are using the same and and it solved the problem from another user.

image

Originally posted by @daniel-hiller in https://github.com/plankanban/planka/issues/399#issuecomment-1437022605

Do you use docker volumes or hostpath mounts?

@daniel-hiller commented on GitHub (Mar 3, 2023): Hi, the config should work fine. We are using the same and and it solved the problem from another user. ![image](https://user-images.githubusercontent.com/46579393/220120643-918606b1-e620-4783-8131-e672c970791a.png) _Originally posted by @daniel-hiller in https://github.com/plankanban/planka/issues/399#issuecomment-1437022605_ Do you use docker volumes or hostpath mounts?
Author
Owner

@Giorgio-Germani commented on GitHub (Mar 3, 2023):

I'm using volumes. We didnt make any changes to the standard configurtion:

volumes:
user-avatars:
project-background-images:
attachments:
db-data:

image

oh, user avatars are working. Thats what i find most surpising.

I checked the location and actually saw the uploaded files there:
image

i honestly don't know what going on.

@Giorgio-Germani commented on GitHub (Mar 3, 2023): I'm using volumes. We didnt make any changes to the standard configurtion: volumes: user-avatars: project-background-images: attachments: db-data: ![image](https://user-images.githubusercontent.com/104979449/222774959-4c57fbc6-eaea-4344-b68e-633c142d8bcc.png) oh, user avatars are working. Thats what i find most surpising. I checked the location and actually saw the uploaded files there: ![image](https://user-images.githubusercontent.com/104979449/222775838-44e9986c-b748-46e9-9ccb-6ca181a6fb93.png) i honestly don't know what going on.
Author
Owner

@daurpam commented on GitHub (Oct 8, 2023):

I've had the same problem. I don't use volumes but mountpoint, The problem was the owner of the directories of attached volumes. The owner was "root", when I've changed to "1000", images and files were uploaded. The command used:
chown 1000:1000 attachments avatars images

@daurpam commented on GitHub (Oct 8, 2023): I've had the same problem. I don't use volumes but mountpoint, The problem was the owner of the directories of attached volumes. The owner was "root", when I've changed to "1000", images and files were uploaded. The command used: ```chown 1000:1000 attachments avatars images```
Author
Owner

@Tsunami2056 commented on GitHub (Nov 12, 2023):

I've had the same problem. I don't use volumes but mountpoint, The problem was the owner of the directories of attached volumes. The owner was "root", when I've changed to "1000", images and files were uploaded. The command used: chown 1000:1000 attachments avatars images

I have to say this solved it for me too, it was a permissions issue on the path I was using for a volume (bind mounted).

However I'm not sure the above users are encountering the same problem as their instance did create the subfolders ?

@Tsunami2056 commented on GitHub (Nov 12, 2023): > I've had the same problem. I don't use volumes but mountpoint, The problem was the owner of the directories of attached volumes. The owner was "root", when I've changed to "1000", images and files were uploaded. The command used: `chown 1000:1000 attachments avatars images` I have to say this solved it for me too, it was a permissions issue on the path I was using for a volume (bind mounted). However I'm not sure the above users are encountering the same problem as their instance did create the subfolders ?
Author
Owner

@Giorgio-Germani commented on GitHub (Nov 13, 2023):

Isse was related to folder rights. Can be closed

@Giorgio-Germani commented on GitHub (Nov 13, 2023): Isse was related to folder rights. Can be closed
Author
Owner

@bjj commented on GitHub (Feb 17, 2025):

I found this when hitting a similar issue. I am causing myself headaches by not giving the container UID 1000. I had already discovered that /app/logs has to be bind-mounted in that case (since running with a user remapping means planka image can't write on its on /app dir). Turns out when uploading attachments it needs /app/.tmp as well. So I bind mounted a tmp folder and that fixed it.

@bjj commented on GitHub (Feb 17, 2025): I found this when hitting a similar issue. I am causing myself headaches by not giving the container UID 1000. I had already discovered that `/app/logs` has to be bind-mounted in that case (since running with a user remapping means planka image can't write on its on `/app` dir). Turns out when uploading attachments it needs `/app/.tmp` as well. So I bind mounted a tmp folder and that fixed it.
Author
Owner

@amphyvi commented on GitHub (Sep 9, 2025):

I was able to solve it as well by creating the necessary folders to store the relevant data being uploaded, details here https://github.com/plankanban/planka/issues/852#issuecomment-3272078920

@amphyvi commented on GitHub (Sep 9, 2025): I was able to solve it as well by creating the necessary folders to store the relevant data being uploaded, details here https://github.com/plankanban/planka/issues/852#issuecomment-3272078920
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#225