-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Description I am trying to configure File Browser to force the download of PDF files on mobile devices instead of using the plugin to view them. Despite configuring Apache as a reverse proxy and setting the Content-Disposition header, PDFs continue to open in Chrome's built-in viewer on Android.
Expected behaviour I expected the PDF files to be automatically downloaded on mobile devices when accessed through File Browser, respecting the Content-Disposition header.
What is happening instead? Instead, the PDF files continue to open in Chrome's built-in viewer on Android, ignoring the Content-Disposition header. This issue occurs only on mobile devices.
Additional context I have configured Apache as a reverse proxy for File Browser and set the Content-Disposition header to force the download of PDFs on mobile devices. However, it seems that Chrome's built-in PDF viewer on Android ignores this header. I have verified that the header is being sent correctly using debugging tools.
How to reproduce?
Configure Apache as a reverse proxy for File Browser.
Set the Content-Disposition header to force the download of PDFs on mobile devices.
Access a PDF file through File Browser using Chrome on an Android device.
Notice that the PDF opens in Chrome's built-in viewer instead of being downloaded.
Files
Apache configuration:
# Configurazione del proxy inverso per File Browser
ProxyPass /filebrowser http://localhost:7080/filebrowser
ProxyPassReverse /filebrowser http://localhost:7080/filebrowser
# Rileva dispositivi mobili
SetEnvIf User-Agent "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series40|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino" IS_MOBILE
# Forza il download dei file PDF sui dispositivi mobili e solo nel percorso /filebrowser
<LocationMatch "^/filebrowser/.*\.pdf$">
Header set Content-Disposition "attachment" env=IS_MOBILE
</LocationMatch>