kiwix / kiwix-tools

Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
https://download.kiwix.org/release/kiwix-tools/
GNU General Public License v3.0
407 stars 79 forks source link

Unable to open PDF files on Chrome #683

Open Popolechien opened 3 weeks ago

Popolechien commented 3 weeks ago

I'm testing recently created Nautilus zim files on dev.library.kiwix.org and when I try to browse the corresponding PDF they get blocked by Chrome (Windows) image

The behaviour does not seem to reproduce on library.kiwix.org

kelson42 commented 3 weeks ago

duplicate of #670?

Popolechien commented 3 weeks ago

Nope, different problem, I cannot reproduce the issue on Chrome mobile.

rgaudin commented 3 weeks ago

I can reproduce and it is not iframe-related as this happens also when browsing on /content.

It does not happen on direct links though.

I tested on a recent Chrome (126), might be interesting to test with an older versions. I see in the inspector that it has a Sec-Fetch-Mode: navigate request header. Server doesn't care but it indicate how Chrome considers this. Is it possible that Chrome now prevents navigating to PDF document ?? Right-clicking open in new tab works as expected…

Screenshot 2024-06-13 at 08 08 59
mgautierfr commented 3 weeks ago

Tested with a random from https://www.gutenberg.org/files/29801/ (clicking to https://www.gutenberg.org/files/29801/29801-pdf.pdf).

pdf open correctly.

Difference seems to be on Cache-Control and Strict-Transport-Security (but not sure it is actually the root cause)

image

mgautierfr commented 3 weeks ago

Removing the `target="_blank" on the link in the node tree make the pdf opening correctly in the current tab...