planka icon indicating copy to clipboard operation
planka copied to clipboard

Can't add an image (Attachment or background)

Open FreeSst opened this issue 2 years ago • 6 comments

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

FreeSst avatar Sep 01 '22 11:09 FreeSst

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 avatar Sep 02 '22 08:09 FreeSst

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

meltyshev avatar Sep 02 '22 11:09 meltyshev

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 avatar Sep 03 '22 11:09 FreeSst

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 avatar Sep 03 '22 12:09 meltyshev

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 avatar Sep 04 '22 09:09 FreeSst

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 avatar Sep 16 '22 13:09 gr0vity-dev

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 avatar Mar 03 '23 14:03 Giorgio-Germani

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 avatar Mar 03 '23 15:03 daniel-hiller

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 avatar Mar 03 '23 16:03 Giorgio-Germani

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 avatar Oct 08 '23 18:10 daurpam

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 avatar Nov 12 '23 11:11 Tsunami2056

Isse was related to folder rights. Can be closed

Giorgio-Germani avatar Nov 12 '23 21:11 Giorgio-Germani