0

I have some website running with PHP. In my .htaccess I have added the following directives:

<FilesMatch "index.php">
        Header add Link "</css/bootstrap.min.css>; rel=preload; as=style"
</FilesMatch>

The websites main content is solely called via the index.php, like this https://somedomain.com or https://somedomain.com/?feature=a.

Within the website I am using Ajax to call further data, from URIs like https://somedomain.com/ajax.php?load=this.

Recently Google Chrome started throwing warnings in the dev console with every Ajax call that is done, like that:

The resource was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally.

Is that a bug in Chrome or is there something wrong with my .htaccess?

Thank you.

Thommy Tomka
  • 332
  • 1
  • 3
  • 14
  • Does this answer your question? [preloading font with rel preload](https://stackoverflow.com/questions/49674092/preloading-font-with-rel-preload) – Justinas Apr 29 '22 at 08:45
  • No, it doesn't. Chrome is telling me on every Ajax call to ajax.php, it would have preloaded the files listed in my .htaccess, though my .htaccess is limiting the preload to happen only when index.php is called. – Thommy Tomka Apr 29 '22 at 08:49
  • And "the" resource the warning is talking about, is actually `/css/bootstrap.min.css`? What response headers do you actually see, when you inspect the AJAX request? – CBroe Apr 29 '22 at 10:18
  • The network view only shows the ajax response. The response headers are these: cache-control: no-store, no-cache, must-revalidate content-encoding: gzip content-length: 580 content-type: text/html;charset=utf-8 date: Fri, 29 Apr 2022 13:00:45 GMT expires: Thu, 19 Nov 1981 08:52:00 GMT header: ....com pragma: no-cache referrer-policy: strict-origin-when-cross-origin server: Apache strict-transport-security: max-age=31536000; includeSubDomains; preload vary: User-Agent,Accept-Encoding x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-xss-protection: 1; mode=block – Thommy Tomka Apr 29 '22 at 13:03

1 Answers1

0

Seems like the issue was a bug in Google Chrome. Since today Chrome doesn't throw the warning anymore.

Thommy Tomka
  • 332
  • 1
  • 3
  • 14