1

Our CakePHP 4 web app sends email to clients with a link for direct download. When the client clicks on the link, the download of the document starts.

This works great if the user receives the mail in their email client, or clicks on the download link in the web app, but if the user receives the mail in Gmail (Web client), the file is not transferred.

Are there any obstacles, or settings?

We also use:

$securityHeaders = new SecurityHeadersMiddleware();
$securityHeaders
        ->setCrossDomainPolicy()
        ->setReferrerPolicy()
        ->setXFrameOptions()
        ->setXssProtection()
        ->noOpen()
        ->noSniff();
Salines
  • 5,674
  • 3
  • 25
  • 50
  • What part isn't working? Is the link broken in GMail? Is the page access logged on your server? Any errors? – Greg Schmidt May 28 '21 at 17:58
  • @GregSchmidt , link is OK. Get request is ok, but browser not start downloading file if referer iz gmail. . We have same download link in web app, and download get. If we click link in outlook or other email apps, download download. – Salines May 28 '21 at 19:09
  • 1
    Use browser tools to examine the request headers and the response in a case where it works and where it doesn't, and see if you can see any important difference? Assuming that you don't have some middleware or firewall or something that's acting based on the referrer and screwing it up for you. – Greg Schmidt May 28 '21 at 23:33
  • 1
    As stated in this [answer](https://stackoverflow.com/a/39518490/5554802) Gmail (like many other Mail Providers) uses a referer. So when you click on `https://example.com/file.ext` the url which will be opened is `https://www.google.com/url?hl=en-GB&q=https://example.com/file.ext&source=gmail&[...]` – mjd Jun 15 '21 at 13:50

0 Answers0