简体   繁体   中英

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".

Can you please try to help me.

Thank you very much in advance.

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;

Thank you for your time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM