makeplane / plane

🔥 🔥 🔥 Open Source JIRA, Linear, Monday, and Asana Alternative. Plane helps you track your issues, epics, and product roadmaps in the simplest way possible.
http://plane.so
GNU Affero General Public License v3.0
30.68k stars 1.71k forks source link

[bug]: problem with the work of attachments for the self-hosted server behind the NGINX proxy #5969

Open KondakovVE opened 1 week ago

KondakovVE commented 1 week ago

Is there an existing issue for this?

Current behavior

Good afternoon. I found the following problem when deploying the self-hosted server

If you use an external NGINX server for the container, there is a problem when post attachments.

As a result of analysis and debugging, it was possible to establish that the reason is in the function apiserver.plane.settings.storage.S3Storage.init

The problem is that when initializing boto3.client, the request.scheme field is passed as the url - that is, the value for nginx will be http and the generated http link is passed to the client for the subsequent method call with the attachment download. But there will be an error (so the site was opened in the user's browser using an https link)

for myself, I just explicitly prescribed the https protocol, but I think it makes sense to introduce some kind of USE_PROXY environment variable that will allow you to work it out correctly

Steps to reproduce

git clone https://github.com/makeplane/plane.git ./setup.sh

then comment service proxy and make config for external nginx

Environment

Production

Browser

Google Chrome

Variant

Self-hosted

Version

0.23.1

akshat5302 commented 1 week ago

Hey @KondakovVE, please ensure your external proxy server is configured to set the following headers for proxied requests:

# Set headers for proxied request
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host  $host;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP         $remote_addr;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;