as the title says when i changed over my nameservers to cloudflare my website truebud.coinpays.ca takes atleast 6-8 seconds just to load.
can someone enlighten me why this is taking so slow compared to the original site truebud.ca
as the title says when i changed over my nameservers to cloudflare my website truebud.coinpays.ca takes atleast 6-8 seconds just to load.
can someone enlighten me why this is taking so slow compared to the original site truebud.ca
The home page HTML is much snappier on your original site, which also goes through Cloudflare. The coinpays one definitely takes longer for the page source to load. And this is not cached by Cloudflare, so your server is taking longer to deliver the content.
The static resources are quick once theyâre cached. Here are two loads. The top is from the original site, and the bottom is from the new site:
i thought i was having it cachedâŚperhaps i missed that step. is there an option i missed? under cache i dont see a whole lot.
Cloudflare does not cache HTML pages by default, because it means cached pages will load even if you update your website. If you want to cache html pages, it is possible, but then you will need to be aware of the pitfall above. To cache HTML pages, you will need to 1. make a new page-rule to âcache everythingâ, and 2. create a page cache rule settings âEdge cache TTLâ, instructing Cloudflare how long to cache your html pages.
Alternatively, #2 could be replaced by settings your own cache-control headers.
still a bit new to all this, what cache rules would i be setting my own? im using nginx on a pi.
what key configurations would help speed it loading even more? I got it down to 4-5 seconds but still unacceptable.
What tool do you use to measure this? Is it all page assets, or just the main html document? Your main bottleneck will normally be your page document, always served from your origin server. Depending on the speed of your server, and if this is a CMS (for example Wordpress), this document could be slow. Ultimately, you need to optimize the speed of your main website document from your server ⌠If it takes more than a 1-2 seconds to output, server is too slow and/or the website/CSS is overloaded with processing.
You can use Cloudflare to cache pages, which will serve cached html pages fast, but itâs really just a âcovering upâ a slow server/website.
If you want to instruct Cloudflare to cache html pages, you would need to include cache-control and expires response headers for your html documents set into the future (normally they are set to 0 or very low values for html document). This is done by nginx expires or by settings headers from the server-side script (like PHP). For example:
cache-control:max-age=315360000
Expires: Mon, 10 Sep 2029 02:37:40 GMT
Then you would need to add a Cloudflare page-rule to cache everything, because html documents are not cached by default. If you donât (or canât) add cache-control headers on your side, you could combine with a âEdge Cache TTLâ rule.
Cloudflare can improve your website in many ways: SSL, CDN (for static assets), compression, http/2 and more. However, the speed that your own server manages to serve the actual page document will always be a bottleneck, unless you cache this output on Cloudflare (which is a bit dodgy).
Here is my configuration for my nginx server wide.
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 512M;
proxy_read_timeout 180s;client_header_timeout 3000;
client_body_timeout 3000;
fastcgi_read_timeout 3000;
#client_max_body_size 32m;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 128k;server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;access_log off;
error_log /home/web/error.log;Gzip Settings
gzip on; gzip_disable "msie6"; #gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_buffers 32 16k; gzip_http_version 1.1; gzip_min_length 250; gzip_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;
#Cannot be enabled until nginx 1.15.2. This requires to build a module that is not supported until 1.15.2
#brotli on;
#brotli_comp_level 4;
#brotli_buffers 32 8k;
#brotli_min_length 100;
#brotli_static on;
#brotli_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 1d;
ssl_session_tickets on;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
resolver_timeout 2s;#add_header X-Frame-Options âSAMEORIGINâ always;
#add_header X-XSS-Protection â1; mode=blockâ always;
#add_header X-Content-Type-Options ânosniffâ always;
#add_header Referrer-Policy âno-referrer-when-downgradeâ always;
#add_header Content-Security-Policy âdefault-src * data: âunsafe-evalâ âunsafe-inlineââ always;
#add_header Strict-Transport-Security âmax-age=31536000; includeSubDomains; preloadâ always;include /etc/nginx/conf.d/*.conf;
}
Im willing to sacrifice a bit of security if it means the pages can be served up faster.
Never sacrifice security for convenience.
when it sacrificing loading pages from 1.3 seconds to 6-8 seconds? Some would argue there is too much security.
I am just trying to find an equilibrium.
Is there anything else i can do to help optimize loading times?
I have SSL, Gzip(cant get brotli on a pi since 1.15.2 is needed but rpi goes to 1.14.2), HTTP/2, i have Edge cache TTL enabled already and im not 100% sure where to stick
cache-control:max-age=315360000
Expires: Mon, 10 Sep 2029 02:37:40 GMT
can a syntax be provided for example sake?
This topic was automatically closed after 30 days. New replies are no longer allowed.