When I load Google's hosted jquery.min.js, it does not return gzipped:
Request headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
Response headers
Age:262255
Cache-Control:public, max-age=31536000
Content-Length:91668
Content-Type:text/javascript; charset=UTF-8
Date:Fri, 11 Nov 2011 13:06:19 GMT
Expires:Sat, 10 Nov 2012 13:06:19 GMT
Last-Modified:Thu, 22 Sep 2011 14:12:07 GMT
Server:sffe
Vary:Accept-Encoding
X-Content-Type-Options:nosniff
X-XSS-Protection:1; mode=block
Interestingly, jquery-ui.min.js does:
Request headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
Response headers
Cache-Control:private, x-gzip-ok="", max-age=31536000
Content-Encoding:gzip
Content-Length:52140
Content-Type:text/javascript; charset=UTF-8
Date:Mon, 14 Nov 2011 13:55:50 GMT
Expires:Mon, 14 Nov 2011 13:55:50 GMT
Last-Modified:Thu, 22 Sep 2011 14:12:07 GMT
Server:sffe
Vary:Accept-Encoding
X-Content-Type-Options:nosniff
X-XSS-Protection:1; mode=block
What's the deal?
I found an article claiming Google disregards Accept-Encoding and looks at User-Agent to decide whether to compress or not. This doesn't explain why latest Safari and Chrome on Mac OS X get uncompressed jQuery (and compressed jQuery UI).
Here's my request headers:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding:gzip, deflate
Accept-Language:en-gb,en;q=0.5
Connection:keep-alive
Host:ajax.googleapis.com
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
I get the following response headers:
Cache-Control: private, x-gzip-ok="", max-age=31536000
Content-Encoding: gzip
Content-Length: 32103
Content-Type: text/javascript; charset=UTF-8
Date: Mon, 14 Nov 2011 13:28:31 GMT
Expires: Mon, 14 Nov 2011 13:28:31 GMT
Last-Modified: Thu, 22 Sep 2011 14:12:07 GMT
Server: sffe
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-XSS-Protection:1; mode=block
Looks like it's gzip by default, as long as the encoding is accepted.
Related
The server log says:
[04/Nov/2019:23:11:23 +0100] "GET /imgs/flags/fr.png HTTP/1.1" 200 2173 "http://XXXXX.com/user/start" "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3959.0 Mobile Safari/537.36"
However, they are being served as text:
This is only happening in production though... in localhost it works fine.
This image loads ok: /imgs/logo_only_transparent.png
This image does not load: /imgs/flags/es.png
Using Ubuntu 18.04, php 7.2, Laravel 6, Vue 2.x
What am I missing?
From the network tab:
Request Method: GET
Status Code: 200 OK
Referrer Policy: no-referrer-when-downgrade
Cache-Control: no-cache, private
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 1205
Content-Type: text/html; charset=UTF-8
Date: Mon, 04 Nov 2019 22:11:23 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.4.29 (Ubuntu)
Set-Cookie: XSRF-TOKEN=eyJpdiI6IkFcL3lRY2JcL0o1R0VyNmRzeXdHcytsQT09IiwidmFsdWUiOiJMNWoyeUUyeW1lMG4zOFNRWnVDWG5jRU1FOFU2bVRuTzl6WmZqQlwvVGFXdnhQWVBVM29vbW1JTEszMldlXC9ra1IiLCJtYWMiOiJjM2JmODA4M2RiODVjZjJjODM5NTliYTFiMzI3NzU2ZDk0YjQwNmY3YTU3YzE1NmE3NzI3ZDM2YTIxODQ2YTY3In0%3D; expires=Tue, 05-Nov-2019 00:11:23 GMT; Max-Age=7200; path=/
Vary: Accept-Encoding
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: es,en;q=0.9
Connection: keep-alive
EDIT (Solved): The reason was that the file is named ES.png no es.png. Apparently this is not an issue when running XAMPP in Windows but it when running it in Ubuntu.
My browser send to the server the following request:
Host: www.imprimante.be
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: */*
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
If-Modified-Since: Fri, 29 May 2015 14:22:44 GMT
If-None-Match: "90-5173935ad3a1a-gzip"
Referer: http://www.imprimante.be/premier-avis-gratuit/
Cookie: <hidden>
Connection: keep-alive
The url used is http://www.imprimante.be/wp-content/themes/mch_imprimante/js/theme.min.js? (note: www.imprimante.be is not accessible trough wlan yet)
And the server send me the file with this (status 200) http header:
Accept-Ranges: bytes
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 137
Content-Type: application/javascript
Date: Wed, 03 Jun 2015 07:18:03 GMT
Etag: "90-5173935ad3a1a-gzip"
Keep-Alive: timeout=5, max=99
Last-Modified: Fri, 29 May 2015 14:22:44 GMT
Server: Apache/2.4.10 (Debian)
Vary: Accept-Encoding
As you might notice (Last-Modified: Fri, 29 May 2015 14:22:44 GMT) the file hasn't been modified since the last request.
So I don't get why the response isn't a 304 status: not modified.
I'd really like to know why the caching of this files (and some others) doesn't work as I expect it.
It is bug in Apache. Turn off mod_deflate.
Using the Chrome network panel, I find that I have one request which keeps returning as 16027.6 days long. Considering how that's longer than my entire life so far, that seems excessive.
Request headers:
GET /performance/login/ HTTP/1.1
Host: 192.168.2.92
Connection: keep-alive
Cache-Control: max-age=0
Accept: */*
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36
X-Requested-With: XMLHttpRequest
Referer: https://192.168.2.92/performance/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: PHPSESSID=qu9e2tbjn98mge14ifpkqf7go4; cw=ee2da41084f3ebaa9012f1120558e4faee99d0e8; session=a%3A8%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%2270de4726ca6e81e779947f11327c492a%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A12%3A%22192.168.2.92%22%3Bs%3A10%3A%22user_agent%22%3 Bs%3A108%3A%22Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F31.0.1650.57+Safari%2F537.36%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1384802015%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3Bs%3A4%3A%22user%22%3Ba%3A8%3A%7Bs%3A2%3A%22id%22%3Bs%3A3%3A%22731%22%3Bs%3A8%3A%22username%22%3Bs%3A9%3A%22support_m%22%3Bs%3A4%3A%22name%22%3Bs%3A4%3A%22Mark%22%3Bs%3A5%3A%22email%22%3Bs%3A31%3A%22moberemk%40publicsectordigest.com%22%3Bs%3A5%3A%22admin%22%3Bs%3A1%3A%221%22%3Bs%3A7%3A%22perf_db%22%3Bs%3A9%3A%22perf_kenn%22%3Bs%3A6%3A%22client%22%3Bs%3A9%3A%22Kennedale%22%3Bs%3A9%3A%22client_id%22%3Bs%3A3%3A%22731%22%3B%7Ds%3A9%3A%22logged_in%22%3Bb%3A1%3Bs%3A15%3A%22app_preferences%22%3Ba%3A2%3A%7Bs%3A12%3A%22trend_period%22%3Bs%3A1%3A%226%22%3Bs%3A10%3A%22trend_unit%22%3Bs%3A6%3A%22months%22%3B%7D%7D65fd2545afa3a2c283d575b9278fbb1c
Response Headers:
HTTP/1.1 200 OK
Date: Mon, 18 Nov 2013 19:17:41 GMT
Server: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
X-Powered-By: PHP/5.4.7
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: max-age=172800, public, must-revalidate
Pragma: no-cache
Set-Cookie: session=a%3A8%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%2270de4726ca6e81e779947f11327c492a%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A12%3A%22192.168.2.92%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A108%3A%22Mozilla%2F5.0+%28Windows+NT+6.1%3B+WOW64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F31.0.1650.57+Safari%2F537.36%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1384802015%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3Bs%3A4%3A%22user%22%3Ba%3A8%3A%7Bs%3A2%3A%22id%22%3Bs%3A3%3A%22731%22%3Bs%3A8%3A%22username%22%3Bs%3A9%3A%22support_m%22%3Bs%3A4%3A%22name%22%3Bs%3A4%3A%22Mark%22%3Bs%3A5%3A%22email%22%3Bs%3A31%3A%22moberemk%40publicsectordigest.com%22%3Bs%3A5%3A%22admin%22%3Bs%3A1%3A%221%22%3Bs%3A7%3A%22perf_db%22%3Bs%3A9%3A%22perf_kenn%22%3Bs%3A6%3A%22client%22%3Bs%3A9%3A%22Kennedale%22%3Bs%3A9%3A%22client_id%22%3Bs%3A3%3A%22731%22%3B%7Ds%3A9%3A%22logged_in%22%3Bb%3A1%3Bs%3A15%3A%22app_preferences%22%3Ba%3A2%3A%7Bs%3A12%3A%22trend_period%22%3Bs%3A1%3A%226%22%3Bs%3A10%3A%22trend_unit%22%3Bs%3A6%3A%22months%22%3B%7D%7D65fd2545afa3a2c283d575b9278fbb1c; expires=Mon, 18-Nov-2013 21:17:42 GMT; path=/
Status: 200
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 153
Keep-Alive: timeout=5, max=90
Connection: Keep-Alive
Content-Type: application/json
I'm not sure exactly what my web server is doing to trigger this, so I'm thinking this might be a Chrome-specific bug. Thoughts?
Looks like a time issue. Check the date on both local and remote machines. That response time is pretty close to the days since epoch which would indicate for some reason the server thinks it's 1970.
If you go to http://www.epochconverter.com/ copy the epoch time at the top (something like 1384805814), enter it in "Convert seconds to days, hours and minutes", you will get something like "16027 days, 20 hours, 16 minutes and 17 second" which is pretty close to what you're seeing in the console.
It's strange, though, to see Date in the response headers as correct and at the same time an expire for sometime in 1981...almost as if webserver is using one date and php is using another.
The solution will depend on what the stack you are using is. https://serverfault.com/ would be a better place to ask for help with the issue.
We are using IBM HTTP server as our web server. Whenever a request is sent to homepage, browser is caching all static files like js or images except CSS.
Why is it caching JS files which are also static but not CSS?
Below are the request and response headers for CSS:
Status Code:200 OK
**Request Headersview**
Accept:text/css,*/*;q=0.1
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
DNT:1
If-Modified-Since:Thu, 14 Feb 2013 20:38:02 GMT
If-None-Match:"6b01-4d5b53c299e80"
Proxy-Connection:keep-alive
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.3 Safari/537.31
**Response Headersview**
Accept-Ranges:bytes
Age:0
Cache-Control:max-age=172800
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:5831
Content-Type:text/css
Date:Tue, 26 Feb 2013 23:50:59 GMT
ETag:"6b01-4d5b53c299e80"
Expires:Thu, 28 Feb 2013 23:50:59 GMT
Last-Modified:Thu, 14 Feb 2013 20:38:02 GMT
Proxy-Connection:Keep-Alive
Server:IBM_HTTP_Server
Vary:Accept-Encoding,User-Agent
Via:1.1 localhost.localdomain
And these are headers for JS files which are returning 304:
**Request Headersview**
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
DNT:1
If-Modified-Since:Thu, 14 Feb 2013 20:38:10 GMT
If-None-Match:"7bcc-4d5b53ca3b080"
Proxy-Connection:keep-alive
User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.3 Safari/537.31
**Response Headersview**
Cache-Control:max-age=172800
Connection:Keep-Alive
Date:Tue, 26 Feb 2013 23:50:58 GMT
Etag:"7bcc-4d5b53ca3b080"
Expires:Thu, 28 Feb 2013 23:50:59 GMT
Proxy-Connection:Keep-Alive
Vary:Accept-Encoding,User-Agent
Via:1.1 localhost.localdomain
I am trying to login this website https://www.bewickedcostumes.com/login.php by httpwebrequest.
//Here is GET
https://www.bewickedcostumes.com/login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y
GET /login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y HTTP/1.1
Host: www.bewickedcostumes.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
X-Requested-With: XMLHttpRequest
Referer: https://www.bewickedcostumes.com/login.php
Cookie: store_language=en; __atuvc=22%7C31%2C14%7C32; RefererCookie=http%3A%2F%2Fwww.bewickedcostumes.com%2Fproduct.php%3Fproductid%3D18078%26cat%3D%26bestseller%3DY; GreetingCookie=Sammy+Chan; xid_d9db5C_remember=schan%40dropshipinc.com; xid_d9db5=21e18e3615c5ed2ef0597789bcd74746
If-Modified-Since: Wed, 08 Aug 2012 01:49:39 GMT
HTTP/1.1 200 OK
Date: Wed, 08 Aug 2012 02:10:57 GMT
Server: Apache
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: private, must-revalidate
P3P: CP="NON CURa ADMa DEVa TAIa CONi OUR DELa BUS IND PHY ONL UNI PUR COM NAV DEM STA"
Set-Cookie: xid_d9db5=21e18e3615c5ed2ef0597789bcd74746; path=/; domain=www.bewickedcostumes.com; httponly
Last-Modified: Wed, 08 Aug 2012 02:10:57 GMT
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 1220
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
//Here is POST
https://www.bewickedcostumes.com/login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y
POST /login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y HTTP/1.1
Host: www.bewickedcostumes.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: https://www.bewickedcostumes.com/login.php
Content-Length: 119
Cookie: store_language=en; __atuvc=22%7C31%2C14%7C32; RefererCookie=http%3A%2F%2Fwww.bewickedcostumes.com%2Fproduct.php%3Fproductid%3D18078%26cat%3D%26bestseller%3DY; GreetingCookie=Sammy+Chan; xid_d9db5C_remember=schan%40dropshipinc.com; xid_d9db5=21e18e3615c5ed2ef0597789bcd74746
Pragma: no-cache
Cache-Control: no-cache
xid_d9db5=21e18e3615c5ed2ef0597789bcd74746&is_remember=&mode=login&username=schan%40dropshipinc.com&password=4700Miller
HTTP/1.1 200 OK
Date: Wed, 08 Aug 2012 02:11:06 GMT
Server: Apache
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: private, must-revalidate
P3P: CP="NON CURa ADMa DEVa TAIa CONi OUR DELa BUS IND PHY ONL UNI PUR COM NAV DEM STA"
Set-Cookie: xid_d9db5=21e7b58ed5b06ad7d5897ad641186f8b; path=/; domain=www.bewickedcostumes.com; httponly
Set-Cookie: GreetingCookie=Sammy+Chan; expires=Mon, 04-Feb-2013 02:11:06 GMT; path=/; domain=www.bewickedcostumes.com; httponly
Last-Modified: Wed, 08 Aug 2012 02:11:06 GMT
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 193
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
My code can login many site but with this site it doesn't work.
This part is a unique code that is generated on the Login page by the looks of it:
xid_d9db5=21e18e3615c5ed2ef0597789bcd74746
Scrape the above field & value & add it to the POST request instead of adding the exact code above to your request.
(You may also want to hide your POST data a bit more carefully incase you use them details elsewhere!)