mysociety / alaveteli

Provide a Freedom of Information request system for your jurisdiction
https://alaveteli.org
Other
389 stars 196 forks source link

NGINX example config doesn't serve cached attachments #4841

Closed kimoensi closed 1 year ago

kimoensi commented 6 years ago

As you can see the response of the authority to the FOI request below .

http://www.informini.org/ar/request/tqryr_lmndwby_hwl_mlf_lkhllt_lml

The authority attached 3 images. These images can be downloaded from "action" button when you choose "Download a zip file of all correspondence". But when you try to click directly from their response it show the 404 NGIX error. example : http://www.informini.org/ar/request/5/response/18/attach/3/img080.jpg?cookie_passthrough=1

It can be an error when parsing attachment or bad configuration, and how to solve it! Thank you

garethrees commented 6 years ago

Hmm, it looks like we've missed the configuration to serve those attachments from our NGINX example configuration.

Here's the Apache version:

https://github.com/mysociety/alaveteli/blob/develop/config/httpd.conf-example#L95-L113

We don't really use NGINX here, so it would be worth posting your question on the alaveteli-dev mailing list, as I'm pretty sure others use NGINX so may have encountered and solved this issue.

I've renamed this issue to reflect what I think the problem may be.

kimoensi commented 6 years ago

Hi Garethrees,

But the other cached attachments are well served through Nginx such as : http://www.informini.org/ar/request/10/response/6/attach/3/.txt?cookie_passthrough=1

Even I can find easily the location, which is not the case for the first attachments ? Do you still think it's Ngix configuration ?

garethrees commented 6 years ago

Oh, that's confusing.

Have you had a look at the Rails logs (APP_ROOT/log/production.log)? It would be worth seeing if any error messages appear when you try to load the attachment.

garethrees commented 5 years ago

We've had a bit of a look in to this and can't see anything obviously wrong.

It would be good to see the following:

Maybe with those we can try to replicate the issue.

Also, it would be worth checking the permissions of the files on disk. Are the ones that are failing readable?

kimoensi commented 5 years ago

The issue is about the Extraction of image attachments. The other formats (pdf, word, xlsx etc ...) works fine except image files

Example : word file (OK) - http://www.informini.org/fr/request/rsl_shkr_6#incoming-49 image file (KO) - http://www.informini.org/fr/request/liste_des_associations_ayant_rec#incoming-58

garethrees commented 5 years ago

Hi @kimoensi,

That's very strange, but really we'd need to see the information above to diagnose further.