Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5.0 Upgrade 404 to Attachments #522

Closed
solariz opened this issue Mar 9, 2020 · 22 comments
Closed

1.5.0 Upgrade 404 to Attachments #522

solariz opened this issue Mar 9, 2020 · 22 comments

Comments

@solariz
Copy link

solariz commented Mar 9, 2020

Hi,

after Upgrading to 1.5 all Attachments only give 404 Errors.
Directory was moved correctly by the upgrade and the corresponding jpg file is in the Directory structure:
/var/www/html/storage/app/attachment

20200309-085654

Running Nginx, tried after the upgrade, got 404 Error. Tried to Apply the Changes as mentioned in the changelog;

APP_DOWNLOAD_ATTACHMENTS_VIA=nginx >> .env

  • part in the vhost.

Unfortunately still 404.

Nginx Error Log:
2020/03/09 09:02:25 [error] 112250#112250: *5 open() "/var/www/html/public/storage/attachment/5/7/1/game_Grafik-Vier-von-zehn-Deutschen-kennen-Augmented-Reality.jpg" failed (2: No such file or directory), client: ########, , server: ########, request: "GET /storage/attachment/5/7/1/game_Grafik-Vier-von-zehn-Deutschen-kennen-Augmented-Reality.jpg?id=1842&token=984a1bbcc43ce7935bfab427da8eb060 HTTP/2.0", host: "inbox.planetlan.work", referrer: "https://inbox.planetlan.work/"

It still tries to read from:
/var/www/html/public/storage/attachment
where /attachment is not existing.

screenshot_20200309-090538

A Quick Workaround to make it read the Attachements via Nginx again is:
ln -sd /var/www/html/storage/app/attachment/ /var/www/html/public/storage

@freescout-helpdesk
Copy link
Contributor

Can you provide full nginx config.

@solariz
Copy link
Author

solariz commented Mar 9, 2020

@freescout-helpdesk
Copy link
Contributor

Nginx config if fine.

APP_DOWNLOAD_ATTACHMENTS_VIA=nginx >> .env

This is not required. Better remove it from .env until you get attachments working.

@freescout-helpdesk
Copy link
Contributor

Make sure that new code actually has been pulled and clear the cache.

@solariz
Copy link
Author

solariz commented Mar 9, 2020

Removed APP_DOWNLOAD_ATTACHMENTS_VIA from .env >Cleared the Cache again.
System is on 1.5.0 with nginx/1.14.2 PHP 7.3.14-1

Unfortunately same 404. Currently it's working but only because I added the symbolic link. If I remove it 404 is back.

@freescout-helpdesk
Copy link
Contributor

Make sure that downloadAttachment() function is being called when accessing an attachment: https://github.com/freescout-helpdesk/freescout/blob/dist/app/Http/Controllers/PublicController.php#L142

@fvdm
Copy link
Contributor

fvdm commented Mar 9, 2020

I had a similar problem where all attachments were empty (0 bytes).

On the shell I ran php artisan freescout:clear-cache which solved it for us.

@solariz
Copy link
Author

solariz commented Mar 9, 2020

Problem is that in Nginx the file as attachment at the end of the conversation seems not to get rewritten and so the webserver tries to open it from the Filesystem instead of passing it though php.

Currently with the symlink it'S working but of course not intended to stay like that, I will have a deeper look into the problem latest wednesday, today I was just to busy.
https://##########/storage/attachment/3/0/1/Futurepak-with-MMK.PDF?id=12345&token=0dff725b00000REDACTED00000000

@freescout-helpdesk
Copy link
Contributor

After updating to 1.5.0 if you are using Nginx make sure to replace

    location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)$ {
        expires 1M;
	access_log off;
	add_header Cache-Control "public";
    }
    location ~* \.(?:css|js)$ {
	expires 2d;
	access_log off;
	add_header Cache-Control "public, must-revalidate";
    }

with

    location ~* ^/storage/attachment/ {
        expires 1M;
        access_log off;
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~* ^/(?:css|js)/.*\.(?:css|js)$ {
        expires 2d;
        access_log off;
        add_header Cache-Control "public, must-revalidate";
    }
    location ~* ^/(?:css|fonts|img|installer|js|modules|[^\\\]+\..*)$ {
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
    }

@solariz
Copy link
Author

solariz commented Mar 10, 2020

Can Confirm, thanks. Indeed the present rules in the NGINX vhost were overwriting the systems php handler. Changed to the suggested one and it works.

-closed

@solariz solariz closed this as completed Mar 10, 2020
@fvdm
Copy link
Contributor

fvdm commented Mar 10, 2020

With APP_DOWNLOAD_ATTACHMENTS_VIA=nginx and the above nginx config none of the FreeScout images load anymore. I think those settings may be conflicting with other nginx configs higher up the chain on our Plesk server.

For us it works better with APP_DOWNLOAD_ATTACHMENTS_VIA commented out and without the nginx config.

@freescout-helpdesk
Copy link
Contributor

Opening for others to see this issue.

@MathijsA
Copy link

MathijsA commented Mar 17, 2020

I done the things listed above but it still isn't working.
Does any one have another idea?

@freescout-helpdesk
Copy link
Contributor

I done the things listed above but it still isn't working.
Does any one have another idea?

Are you updating FreeScout or installing?
Are you using Nginx or Apache?

@MathijsA
Copy link

We have updated freeScout to 1.5.2.
And we (the docker from tiredofit) are using nginx

@freescout-helpdesk
Copy link
Contributor

We have updated freeScout to 1.5.2.
And we (the docker from tiredofit) are using nginx

Have you updated Nginx config? #522 (comment)

@MathijsA
Copy link

yes

@freescout-helpdesk
Copy link
Contributor

Does it work with the symlink?

ln -sd /var/www/html/storage/app/attachment/ /var/www/html/public/storage

@MathijsA
Copy link

no unfortunately it doesn't.

@freescout-helpdesk
Copy link
Contributor

no unfortunately it doesn't.

What error are you receiving? Do you actually have files in /var/www/html/storage/app/attachment/ ?

@MathijsA
Copy link

aha i found it, the docker uses '/data/storage/app/attachment' instead of /var/www/html

@MathijsA
Copy link

Well our ngnix conf was also wrong. Were the location is defined. fixed that and now it works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants