'NGINX not serving preload css
I'm trying to optimize rendering speed of my website.
but Nginx is not serving css link with rel="preload", when it's rel="stylesheet" it's just working fine.
<link href="css/fontawesome.css" rel="preload" onload="clearRel()" as="style"/>
I installed a new nginx version 1.13.7, here's my installed modules:
nginx version: nginx/1.13.7
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.2l 25 May 2017
TLS SNI support enabled
configure arguments: --add-module=/root/ngx_pagespeed-latest-stable
--with-compat
--with-file-aio
--with-threads
--with-http_addition_module
--with-http_auth_request_module
--with-http_dav_module
--with-http_flv_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_mp4_module
--with-http_random_index_module
--with-http_realip_module
--with-http_slice_module
--with-http_ssl_module
--with-http_sub_module
--with-http_stub_status_module
--with-http_v2_module
--with-http_secure_link_module
--with-mail
--with-mail_ssl_module
--with-stream
--with-stream_realip_module
--with-stream_ssl_module
--with-stream_ssl_preread_module
--with-debug
--with-cc-opt='-g
-O2
-fPIE
-fstack-protector-strong
-Wformat
-Werror=format-security
-Wdate-time
-D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-Bsymbolic-functions
-fPIE
-pie
-Wl,-z,relro
-Wl,-z,now'
I have no matching log of CSS files when it's on rel="preload".
Solution 1:[1]
I resolved the problem. It was Google PageSpeed module that blocks preload links. I added an Nginx directive and everything went well:
pagespeed EnableFilters inline_css;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TylerH |