After a lot of unsuccessful research, I'm wondering if it's possible to use nginx or varnish cache function to check data freshness it contains using etag attribute in the header.
This scenario is easier to explain with a diagram, please see below :
http://image.noelshack.com/fichiers/2014/49/1417684577-cache-nginx.png
Do you think this use case is feasible ?
Thank you and sorry for my english :s
You can do something similar with varnish, stale-while-revalidate, but not quite the same. The idea with the front caches is that when the backend sends an object to the cache it sets an Expires header that will allow the cache to serve this content without bothering the backend. If the cache would check every request with the backend then there wouldn't be much speed to gain, as you would end up waiting for the backend on each request.
To solve this, you should set your Expires headers accordingly, and/or purge/ban the urls if suddenly you need to get rid of stale content before Expires. That way the cache would send the content from its own cache, or get from the backend if it doesn't have it or it's stale.
Edit:
I have tested with Varnish 4.0.1, it supports conditional requests to the backend.
My test setup has been an Apache virtual hosts with ExpiresByType text/html "access plus 5 seconds"
The result:
* << BeReq >> 65539
- Begin bereq 65538 bgfetch
- Timestamp Start: 1418403624.141695 0.000000 0.000000
- BereqMethod GET
- BereqURL /prueba.html
- BereqProtocol HTTP/1.1
- BereqHeader User-Agent: lwp-request/6.03 libwww-perl/6.05
- BereqHeader X-Forwarded-For: 127.0.0.1
- BereqHeader Host: localtest
- BereqHeader Surrogate-Capability: key=ESI/1.0
- BereqHeader Accept-Encoding: gzip
- BereqHeader If-Modified-Since: Thu, 01 Dec 2011 10:37:55 GMT
- BereqHeader If-None-Match: "3e8be5-46-4b30571f606c0"
- BereqHeader X-Varnish: 65539
- VCL_call BACKEND_FETCH
- VCL_return fetch
- Backend 17 vdir server1(127.0.0.1,,80)
- Timestamp Bereq: 1418403624.141869 0.000174 0.000174
- Timestamp Beresp: 1418403624.143205 0.001510 0.001336
- BerespProtocol HTTP/1.1
- BerespStatus 304
- BerespReason Not Modified
- BerespHeader Date: Fri, 12 Dec 2014 17:00:24 GMT
- BerespHeader Server: Apache
- BerespHeader ETag: "3e8be5-46-4b30571f606c0"
- BerespHeader Expires: Fri, 12 Dec 2014 17:00:29 GMT
- BerespHeader Cache-Control: max-age=5
- TTL RFC 5 -1 -1 1418403624 1418403624 1418403624 1418403629 5
- BerespProtocol HTTP/1.1
- BerespStatus 200
- BerespReason OK
- BerespHeader Last-Modified: Thu, 01 Dec 2011 10:37:55 GMT
- BerespHeader Content-Type: text/html
- VCL_call BACKEND_RESPONSE
- TTL VCL 5 21600 0 1418403624
- VCL_return deliver
- Storage malloc s0
- ObjProtocol HTTP/1.1
- ObjStatus 200
- ObjReason OK
- ObjHeader Date: Fri, 12 Dec 2014 17:00:24 GMT
- ObjHeader Server: Apache
- ObjHeader ETag: "3e8be5-46-4b30571f606c0"
- ObjHeader Expires: Fri, 12 Dec 2014 17:00:29 GMT
- ObjHeader Cache-Control: max-age=5
- ObjHeader Last-Modified: Thu, 01 Dec 2011 10:37:55 GMT
- ObjHeader Content-Type: text/html
- BackendReuse 17 server1(127.0.0.1,,80)
- Timestamp BerespBody: 1418403624.143465 0.001770 0.000260
- Length 70
- BereqAcct 289 0 289 181 0 181
- End
Here you can see that I ask for a stale object, so varnish goes to fetch it, and request it this way:
- BereqURL /prueba.html
- BereqHeader If-Modified-Since: Thu, 01 Dec 2011 10:37:55 GMT
- BereqHeader If-None-Match: "3e8be5-46-4b30571f606c0"
The backend answers with:
- BerespStatus 304
- BerespReason Not Modified
- BerespHeader Date: Fri, 12 Dec 2014 17:00:24 GMT
- BerespHeader ETag: "3e8be5-46-4b30571f606c0"
- BerespHeader Expires: Fri, 12 Dec 2014 17:00:29 GMT
- BerespHeader Cache-Control: max-age=5
So no body bytes are transferred, and varnish refreshes it's object with the newly updated headers.
Perhaps that's the behavior you wanted.
Keep in mind that a GET request that does validate the conditions (If-Modified-Since and If-None-Match) would only return a 304 Not Modified, some headers and no body (exactly the same as if it would be a HEAD request with the same conditions), if it doesn't validate it will return the headers and the new body. But a HEAD requests that does not validate would return 200 OK, and NO body, forcing you to re-request it with a GET.
HTTP/1.1 Method Definitions RFC:
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation
contained in the HTTP headers in response to a HEAD request SHOULD be
identical to the information sent in response to a GET request.
Related
I'm trying to install and configure varnish in mey srever, and I think I've done it, altought when I run the teste i get:
curl -I http://localhost
HTTP/1.1 503 Backend fetch failed
Date: Mon, 26 Aug 2019 17:16:50 GMT
Server: Varnish
Content-Type: text/html; charset=utf-8
Retry-After: 5
X-Varnish: 32770
Age: 0
Via: 1.1 varnish (Varnish/5.2)
Connection: keep-alive
Can any expert help me?
For what i see i get this problem "HTTP/1.1 503 Backend fetch failed", I've already locate more memory but the problem persists...
Best regards,
Leonel Nunes
BereqProtocol HTTP/1.0
BereqHeader Host: www.test.com
BereqHeader X-Forwarded-For: 145.239.78.207
BereqHeader grace: none
BereqHeader X-Varnish: 30
VCL_call BACKEND_FETCH
VCL_return fetch
BackendOpen 29 boot.default 145.239.78.207 8080 145.239.78.207 56942
BackendStart 145.239.78.207 8080
Timestamp Bereq: 1568108230.028067 0.000121 0.000121
BerespProtocol HTTP/1.0
Timestamp Beresp: 1568108230.030388 0.002443 0.002321
BerespProtocol HTTP/1.0
BerespStatus 200
BerespReason OK
BerespHeader Date: Tue, 10 Sep 2019 09:37:10 GMT
BerespHeader Server: Apache
BerespHeader Last-Modified: Fri, 23 Aug 2019 01:46:14 GMT
BerespHeader Accept-Ranges: bytes
BerespHeader Content-Length: 7725
BerespHeader Cache-Control: max-age=31536000
BerespHeader Expires: Wed, 09 Sep 2020 09:37:10 GMT
BerespHeader X-Frame-Options: SAMEORIGIN
BerespHeader Connection: close
BerespHeader Content-Type: image/jpeg
VCL_call BACKEND_RESPONSE
TTL VCL -1 259200 0 1568108230
TTL VCL 120 259200 0 1568108230
VCL_return deliver
Storage malloc Transient
ObjProtocol HTTP/1.0
ObjStatus 200
ObjReason OK
ObjHeader Date: Tue, 10 Sep 2019 09:37:10 GMT
ObjHeader Server: Apache
ObjHeader Last-Modified: Fri, 23 Aug 2019 01:46:14 GMT
ObjHeader Accept-Ranges: bytes
ObjHeader Content-Length: 7725
ObjHeader Cache-Control: max-age=31536000
ObjHeader Expires: Wed, 09 Sep 2020 09:37:10 GMT
ObjHeader X-Frame-Options: SAMEORIGIN
ObjHeader Content-Type: image/jpeg
Fetch_Body 3 length stream
BackendClose 29 boot.default
Timestamp BerespBody: 1568108230.030469 0.002524 0.000082
Length 7725
BereqAcct 192 0 192 309 7725 8034
End
<< Request >> 38
Begin req 37 rxreq
Timestamp Start: 1568108230.176665 0.000000 0.000000
Timestamp Req: 1568108230.176665 0.000000 0.000000
ReqStart 145.239.78.207 40768
ReqMethod GET
ReqURL /pub/static/version1567874318/frontend/Swissup/absolute/pt_PT/images/payments/ww.png
ReqProtocol HTTP/1.0
ReqHeader Host: www.test.com
ReqHeader Connection: close
ReqHeader X-Forwarded-For: 145.239.78.207
VCL_call RECV
ReqHeader grace: none
ReqURL /pub/static/version1567874318/frontend/Swissup/absolute/pt_PT/images/payments/ww.png
VCL_return pass
VCL_call HASH
VCL_return lookup
VCL_call PASS
VCL_return fetch
Link bereq 39 pass
Timestamp Fetch: 1568108230.178857 0.002191 0.002191
RespProtocol HTTP/1.0
RespStatus 200
RespReason OK
RespHeader Date: Tue, 10 Sep 2019 09:37:10 GMT
RespHeader Server: Apache
RespHeader Last-Modified: Tue, 03 Sep 2019 16:11:49 GMT
RespHeader Accept-Ranges: bytes
RespHeader Content-Length: 1003
RespHeader Cache-Control: max-age=31536000, public
RespHeader Expires: Wed, 09 Sep 2020 09:37:10 GMT
RespHeader X-Frame-Options: SAMEORIGIN
RespHeader Content-Type: image/png
RespProtocol HTTP/1.1
RespHeader X-Varnish: 38
RespHeader Age: 0
RespHeader Via: 1.1 varnish (Varnish/5.2)
VCL_call DELIVER
RespUnset Age: 0
VCL_return deliver
Timestamp Process: 1568108230.178877 0.002212 0.000021
RespHeader Connection: close
Timestamp Resp: 1568108230.178912 0.002246 0.000035
ReqAcct 155 0 155 363 1003 1366
End
<< Session >> 37
Begin sess 0 HTTP/1
SessOpen 145.239.78.207 40768 a0 145.239.78.207 80 1568108230.176609 26
Link req 38 rxreq
SessClose REQ_CLOSE 0.002
End
<< BeReq >> 98340
Begin bereq 98339 pass
Timestamp Start: 1568108230.180024 0.000000 0.000000
BereqMethod GET
BereqURL /pub/static/version1567874318/frontend/Swissup/absolute/pt_PT/images/payments/paypal.png
BereqProtocol HTTP/1.0
BereqHeader Host: www.test.com
BereqHeader X-Forwarded-For: 145.239.78.207
BereqHeader grace: none
BereqHeader X-Varnish: 98340
VCL_call BACKEND_FETCH
VCL_return fetch
BackendOpen 29 boot.default 145.239.78.207 8080 145.239.78.207 56974
BackendStart 145.239.78.207 8080
Timestamp Bereq: 1568108230.180132 0.000108 0.000108
BerespProtocol HTTP/1.0
Timestamp Beresp: 1568108230.181992 0.001968 0.001860
BerespProtocol HTTP/1.0
BerespStatus 200
BerespReason OK
BerespHeader Date: Tue, 10 Sep 2019 09:37:10 GMT
BerespHeader Server: Apache
BerespHeader Last-Modified: Tue, 03 Sep 2019 16:11:49 GMT
BerespHeader Accept-Ranges: bytes
BerespHeader Content-Length: 1757
BerespHeader Cache-Control: max-age=31536000, public
BerespHeader Expires: Wed, 09 Sep 2020 09:37:10 GMT
BerespHeader X-Frame-Options: SAMEORIGIN
BerespHeader Connection: close
BerespHeader Content-Type: image/png
VCL_call BACKEND_RESPONSE
TTL VCL -1 259200 0 1568108230
TTL VCL 120 259200 0 1568108230
VCL_return deliver
Storage malloc Transient
ObjProtocol HTTP/1.0
ObjStatus 200
ObjReason OK
ObjHeader Date: Tue, 10 Sep 2019 09:37:10 GMT
ObjHeader Server: Apache
ObjHeader Last-Modified: Tue, 03 Sep 2019 16:11:49 GMT
ObjHeader Accept-Ranges: bytes
ObjHeader Content-Length: 1757
ObjHeader Cache-Control: max-age=31536000, public
ObjHeader Expires: Wed, 09 Sep 2020 09:37:10 GMT
ObjHeader X-Frame-Options: SAMEORIGIN
ObjHeader Content-Type: image/png
Fetch_Body 3 length stream
BackendClose 29 boot.default
Timestamp BerespBody: 1568108230.182080 0.002055 0.000088
Length 1757
BereqAcct 204 0 204 316 1757 2073
End
<< Request >> 98339
Begin req 98338 rxreq
Timestamp Start: 1568108230.179969 0.000000 0.000000
Timestamp Req: 1568108230.179969 0.000000 0.000000
ReqStart 145.239.78.207 40772
ReqMethod GET
ReqURL /pub/static/version1567874318/frontend/Swissup/absolute/pt_PT/images/payments/paypal.png
ReqProtocol HTTP/1.0
ReqHeader Host: www.test.com
ReqHeader Connection: close
ReqHeader X-Forwarded-For: 145.239.78.207
VCL_call RECV
ReqHeader grace: none
ReqURL /pub/static/version1567874318/frontend/Swissup/absolute/pt_PT/images/payments/paypal.png
VCL_return pass
VCL_call HASH
VCL_return lookup
VCL_call PASS
VCL_return fetch
Link bereq 98340 pass
Timestamp Fetch: 1568108230.182061 0.002092 0.002092
RespProtocol HTTP/1.0
RespStatus 200
RespReason OK
RespHeader Date: Tue, 10 Sep 2019 09:37:10 GMT
RespHeader Server: Apache
RespHeader Last-Modified: Tue, 03 Sep 2019 16:11:49 GMT
RespHeader Accept-Ranges: bytes
RespHeader Content-Length: 1757
RespHeader Cache-Control: max-age=31536000, public
RespHeader Expires: Wed, 09 Sep 2020 09:37:10 GMT
RespHeader X-Frame-Options: SAMEORIGIN
RespHeader Content-Type: image/png
RespProtocol HTTP/1.1
RespHeader X-Varnish: 98339
RespHeader Age: 0
RespHeader Via: 1.1 varnish (Varnish/5.2)
VCL_call DELIVER
RespUnset Age: 0
VCL_return deliver
Timestamp Process: 1568108230.182087 0.002118 0.000026
RespHeader Connection: close
Timestamp Resp: 1568108230.182146 0.002177 0.000058
ReqAcct 159 0 159 366 1757 2123
End
Not enough detail for a succinct answer.
To cut the problem in-half, try to browse http address of the backend server?
Another important consideration, Have you properly configured, /etc/varnish/user.vcl ?
Here is a Varnish tutorial... https://www.linode.com/docs/websites/varnish/getting-started-with-varnish-cache/
Finally, find the location of the Varnish log file to get more details.
I will post a complete log:
varnishlog
* << BeReq >> 84
- Begin bereq 83 fetch
- Timestamp Start: 1566844978.393604 0.000000 0.000000
- BereqMethod GET
- BereqURL /index.php/giantpointsadmin/adminhtml_earning_rate/index
- BereqProtocol HTTP/1.1
- BereqHeader Host: www.test.pt
- BereqHeader User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36
- BereqHeader X-Forwarded-For: 51.89.7.90
- BereqHeader grace: none
- BereqHeader Accept-Encoding: gzip
- BereqHeader X-Varnish: 84
- VCL_call BACKEND_FETCH
- VCL_return fetch
- FetchError no backend connection
- Timestamp Beresp: 1566844978.393680 0.000077 0.000077
- Timestamp Error: 1566844978.393687 0.000083 0.000007
- BerespProtocol HTTP/1.1
- BerespStatus 503
- BerespReason Service Unavailable
- BerespReason Backend fetch failed
- BerespHeader Date: Mon, 26 Aug 2019 18:42:58 GMT
- BerespHeader Server: Varnish
- VCL_call BACKEND_ERROR
- BerespHeader Content-Type: text/html; charset=utf-8
- BerespHeader Retry-After: 5
- VCL_return deliver
- Storage malloc Transient
- ObjProtocol HTTP/1.1
- ObjStatus 503
- ObjReason Backend fetch failed
- ObjHeader Date: Mon, 26 Aug 2019 18:42:58 GMT
- ObjHeader Server: Varnish
- ObjHeader Content-Type: text/html; charset=utf-8
- ObjHeader Retry-After: 5
- Length 279
- BereqAcct 0 0 0 0 0 0
- End
<< Request >> 83
Begin req 82 rxreq
Timestamp Start: 1566844978.384062 0.000000 0.000000
Timestamp Req: 1566844978.393264 0.009202 0.009202
ReqStart 51.89.7.90 55715
ReqMethod GET
ReqURL /index.php/giantpointsadmin/adminhtml_earning_rate/index
ReqProtocol HTTP/1.1
ReqHeader Host: www.test.pt
ReqHeader Connection: keep-alive
ReqHeader Accept-Encoding: gzip,deflate
ReqHeader User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36
ReqHeader X-Forwarded-For: 51.89.7.90
VCL_call RECV
ReqHeader grace: none
ReqURL /index.php/giantpointsadmin/adminhtml_earning_rate/index
ReqUnset Accept-Encoding: gzip,deflate
ReqHeader Accept-Encoding: gzip
VCL_return hash
VCL_call HASH
VCL_return lookup
VCL_call MISS
VCL_return fetch
Link bereq 84 fetch
Timestamp Fetch: 1566844978.393832 0.009770 0.000568
RespProtocol HTTP/1.1
RespStatus 503
RespReason Backend fetch failed
RespHeader Date: Mon, 26 Aug 2019 18:42:58 GMT
RespHeader Server: Varnish
RespHeader Content-Type: text/html; charset=utf-8
RespHeader Retry-After: 5
RespHeader X-Varnish: 83
RespHeader Age: 0
RespHeader Via: 1.1 varnish (Varnish/5.2)
VCL_call DELIVER
VCL_return deliver
Timestamp Process: 1566844978.393857 0.009795 0.000025
RespHeader Content-Length: 279
RespHeader Connection: keep-alive
Timestamp Resp: 1566844978.393929 0.009868 0.000072
ReqAcct 266 0 266 247 279 526
End
<< Session >> 82
Begin sess 0 HTTP/1
SessOpen 51.89.7.90 55715 a0 145.239.78.207 80 1566844978.383924 25
Link req 83 rxreq
SessClose REM_CLOSE 0.020
End
<< BeReq >> 32855
Begin bereq 32854 pass
Timestamp Start: 1566844978.423125 0.000000 0.000000
BereqMethod POST
BereqURL /index.php/giantpointsadmin/adminhtml_earning_rate/index/
BereqProtocol HTTP/1.1
BereqHeader Host: www.test.pt
BereqHeader Accept-Encoding: gzip,deflate
BereqHeader Content-Type: multipart/form-data; boundary=----------------7O12ZqAnhn621bBI
BereqHeader Content-Length: 326
BereqHeader User-Agent: Opera/9.80 (Windows NT 6.0); U) Presto/2.12.388 Version/12.16
BereqHeader Cookie: adminhtml=86g8r80a2uhrf66b95f2lnslo0
BereqHeader X-Forwarded-For: 51.89.7.90
BereqHeader X-Varnish: 32855
VCL_call BACKEND_FETCH
VCL_return fetch
FetchError no backend connection
Timestamp Beresp: 1566844978.423157 0.000033 0.000033
Timestamp Error: 1566844978.423165 0.000040 0.000008
BerespProtocol HTTP/1.1
BerespStatus 503
BerespReason Service Unavailable
BerespReason Backend fetch failed
BerespHeader Date: Mon, 26 Aug 2019 18:42:58 GMT
BerespHeader Server: Varnish
VCL_call BACKEND_ERROR
BerespHeader Content-Type: text/html; charset=utf-8
BerespHeader Retry-After: 5
VCL_return deliver
Storage malloc Transient
ObjProtocol HTTP/1.1
ObjStatus 503
ObjReason Backend fetch failed
ObjHeader Date: Mon, 26 Aug 2019 18:42:58 GMT
ObjHeader Server: Varnish
ObjHeader Content-Type: text/html; charset=utf-8
ObjHeader Retry-After: 5
Length 282
BereqAcct 0 0 0 0 0 0
End
<< Request >> 32854
Begin req 32853 rxreq
Timestamp Start: 1566844978.413495 0.000000 0.000000
Timestamp Req: 1566844978.422953 0.009458 0.009458
ReqStart 51.89.7.90 55717
ReqMethod POST
ReqURL /index.php/giantpointsadmin/adminhtml_earning_rate/index/
ReqProtocol HTTP/1.1
ReqHeader Host: www.test.pt
ReqHeader Connection: keep-alive
ReqHeader Accept-Encoding: gzip,deflate
ReqHeader Content-Type: multipart/form-data; boundary=----------------7O12ZqAnhn621bBI
ReqHeader Content-Length: 326
ReqHeader User-Agent: Opera/9.80 (Windows NT 6.0); U) Presto/2.12.388 Version/12.16
ReqHeader Cookie: adminhtml=86g8r80a2uhrf66b95f2lnslo0
ReqHeader X-Forwarded-For: 51.89.7.90
VCL_call RECV
VCL_return pass
VCL_call HASH
VCL_return lookup
VCL_call PASS
VCL_return fetch
Link bereq 32855 pass
Timestamp Fetch: 1566844978.423294 0.009799 0.000341
Storage malloc Transient
Timestamp ReqBody: 1566844978.423314 0.009819 0.000020
RespProtocol HTTP/1.1
RespStatus 503
RespReason Backend fetch failed
RespHeader Date: Mon, 26 Aug 2019 18:42:58 GMT
RespHeader Server: Varnish
RespHeader Content-Type: text/html; charset=utf-8
RespHeader Retry-After: 5
RespHeader X-Varnish: 32854
RespHeader Age: 0
RespHeader Via: 1.1 varnish (Varnish/5.2)
VCL_call DELIVER
VCL_return deliver
Timestamp Process: 1566844978.423336 0.009841 0.000022
RespHeader Content-Length: 282
RespHeader Connection: keep-alive
Timestamp Resp: 1566844978.423392 0.009897 0.000056
ReqAcct 374 326 700 250 282 532
End
<< Session >> 32853
Begin sess 0 HTTP/1
SessOpen 51.89.7.90 55717 a0 145.239.78.207 80 1566844978.413439 24
Link req 32854 rxreq
SessClose REM_CLOSE 0.020
End
Best regards,
Leonel Nunes
I've been looking around for solutions before asking this questions but unfortunately none of them yielded good results.
I get a OpenURI::HTTPError: 405 Not Allowed when accessing this specific url:
require 'open-uri'
doc = Nokogiri::HTML(open("http://streeteasy.com"))
#=> OpenURI::HTTPError: 405 Not Allowed
from /Users/cyrusghazanfar/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/open-uri.rb:358:in `open_http'
also tried:
$ curl -I http://streeteasy.com
which returned:
HTTP/1.1 405 Not Allowed
Date: Fri, 22 Sep 2017 20:03:59 GMT
Content-Type: text/html
Connection: keep-alive
Server: nginx
X-DZ: 24.193.31.96
Vary: Accept-Encoding
X-DZ: 127.0.0.1
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Cache-Control: private, no-cache, no-store, must-revalidate
Edge-Control: no-store, bypass-cache
Surrogate-Control: no-store, bypass-cache
the problem is that the server needs an User-Agent header to work, so in curl it would be like:
curl --header "User-Agent: Mozilla/5.0" http://streeteasy.com
I have configured Hadoop HDFS with security enabled using Kerberos (CDH4.3). It works fine, I can do all the operations using command line tools. There are some other non hadoop cluster nodes need to access HDFS file system thru REST API, so I have webhdfs enabled with Kerberos configured.
My secure webhdfs works fine for operations that don't involve temporary redirect: ie LISTSTATUS, create directory, remove directory, remove files, all work fine. But for two step operations like create file, open file, it failed with below info:
[DEV][root#namenode ~]# curl -i --negotiate -u : -X
PUT "http: //namenode:50070/webhdfs/v1/tmp/hosts.txt?op=CREATE"
HTTP/1.1 401
Date: Fri, 25 Apr 2014 02:45:48 GMT
Pragma: no-cache
Date: Fri, 25 Apr 2014 02:45:48 GMT
Pragma: no-cache
WWW-Authenticate: Negotiate
Set-Cookie: hadoop.auth=;Path=/;Expires=Thu, 01-Jan-1970 00:00:00 GMT
Content-Length: 0
Server: Jetty(6.1.26.cloudera.2)
HTTP/1.1 307 TEMPORARY_REDIRECT
Cache-Control: no-cache
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Date: Fri, 25 Apr 2014 02:45:48 GMT
Pragma: no-cache
Date: Fri, 25 Apr 2014 02:45:48 GMT
Pragma: no-cache
Set-Cookie:
hadoop.auth="u=hdfs&p=hdfs#UNIXKRB&t=kerberos&e=1398429948267&s=XhEp/tfs5Pfp04Dp
9yy1moFPnEo=";Path=/
Location: http: //datanode.net:1006/webhdfs/v1/tmp/hosts.txt?
op=CREATE&delegation=HgAEaGRmcwRoZGZzAIoBRZbGSGyKAUW60sxsWo4BAhTfG8IRyDJjJ2BSR7K
hveMEo3V4dxJXRUJIREZTIGRlbGVnYXRpb24NMC4wLjAuMDo1MDA3MA&namenoderpcaddress=
namenode.net:8020&overwrite=false
Content-Type: application/octet-stream
Content-Length: 0
Server: Jetty(6.1.26.cloudera.2)
[DEV][root#namenode~]# curl -i -X PUT -T hosts.txt
http: //datanode.net:1006/webhdfs/v1/tmp/hosts.txt?
op=CREATE&delegation=HgAEaGRmcwRoZGZzAIoBRZbGSGyKAUW60sxsWo4BAhTfG8IRyDJjJ2
BSR7KhveMEo3V4dxJXRUJIREZTIGRlbGVnYXRpb24NMC4wLjAuMDo1MDA3MA&namenoderpcaddress=
namenode.net:8020&overwrite=false
[2] 19047
[3] 19048
[4] 19049
[DEV][root#namenode~]# HTTP/1.1 100 Continue
HTTP/1.1 401 Unauthorized
Cache-Control: no-cache
Expires: Fri, 25 Apr 2014 02:46:26 GMT
Date: Fri, 25 Apr 2014 02:46:26 GMT
Pragma: no-cache
Expires: Fri, 25 Apr 2014 02:46:26 GMT
Date: Fri, 25 Apr 2014 02:46:26 GMT
Pragma: no-cache
Content-Type: application/json
Transfer-Encoding: chunked
Server: Jetty(6.1.26.cloudera.2)
{"RemoteException":
{"exception":"SecurityException","javaClassName":"java.lang.SecurityException",
"message":"Failed to obtain user group information: java.io.IOException:
Security enabled but user not authenticated by filter"}}
[2] Done curl -i -X PUT -T hosts.txt
http://datanode.net:1006/webhdfs/v1/tmp/hosts.txt?op=CREATE
[3] Done
delegation=HgAEaGRmcwRoZGZzAIoBRZbGSGyKAUW60sxsWo4BAhTfG8IRyDJjJ2BSR7KhveM
Eo3V4dxJXRUJIREZTIGRlbGVnYXRpb24NMC4wLjAuMDo1MDA3MA
[4]- Done namenoderpcaddress=namenode.net:8020
[DEV][root#namenode ~]#
Is there anyone who can shed some lights?
Thanks a lot,
In my case it was working fine as below:
$ curl -i --negotiate -u : -X PUT "http://nn30.my.dom:50070/webhdfs/v1/tmp/hosts.txt?op=CREATE"
HTTP/1.1 401
Date: Wed, 30 Apr 2014 12:39:24 GMT
Pragma: no-cache
Date: Wed, 30 Apr 2014 12:39:24 GMT
Pragma: no-cache
WWW-Authenticate: Negotiate
Set-Cookie: hadoop.auth=;Path=/;Expires=Thu, 01-Jan-1970 00:00:00 GMT
Content-Length: 0
Server: Jetty(7.6.10.v20130312)
HTTP/1.1 307 Temporary Redirect
Date: Wed, 30 Apr 2014 12:39:24 GMT
Pragma: no-cache
Cache-Control: no-cache
Date: Wed, 30 Apr 2014 12:39:24 GMT
Pragma: no-cache
Set-Cookie: hadoop.auth="u=gpadmin&p=gpadmin#MY.DOM&t=kerberos&e=1398897564735&s=p8haj7KXAsUqj5A2WzoE5VxJYA8=";Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Location: http ://dn33.my.dom:1006/webhdfs/v1/tmp/hosts.txt?op=CREATE&delegation=IgAHZ3BhZG1pbgdncGFkbWluAIoBRbKli0OKAUXWsg9DAxIUt8i6BG2xt5V4wB4vPpXSPm8MMVMSV0VCSERGUyBkZWxlZ2F0aW9uEzE5Mi4xNjguMTAuMzA6NTAwNzA&namenoderpcaddress=nn30.my.dom:8020&overwrite=false
Content-Type: application/octet-stream
Content-Length: 0
Server: Jetty(7.6.10.v20130312)
$ curl -i -X PUT -T hosts.txt "http://dn33.my.dom:1006/webhdfs/v1/tmp/hosts.txt?op=CREATE&delegation=IgAHZ3BhZG1pbgdncGFkbWluAIoBRbKli0OKAUXWsg9DAxIUt8i6BG2xt5V4wB4vPpXSPm8MMVMSV0VCSERGUyBkZWxlZ2F0aW9uEzE5Mi4xNjguMTAuMzA6NTAwNzA&namenoderpcaddress=nn30.my.dom:8020&overwrite=false"
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Expires: Wed, 30 Apr 2014 12:42:24 GMT
Date: Wed, 30 Apr 2014 12:42:24 GMT
Pragma: no-cache
Cache-Control: no-cache
Expires: Wed, 30 Apr 2014 12:42:24 GMT
Date: Wed, 30 Apr 2014 12:42:24 GMT
Pragma: no-cache
Location: webhdfs ://nn30.my.dom:50070/tmp/hosts.txt
Content-Type: application/octet-stream
Content-Length: 0
Server: Jetty(7.6.10.v20130312)
NOTE - if your screen capture was not the edited/modified you had few syntax issues ("") and typo things. I bet you missed "" for the http input from first command.
check here for your info - http ://hadoop.apache.org/docs/r1.0.4/webhdfs.html
BTW, I used Pivotal HD, there shouldn't be that much difference though.
I create one proxy cache using (tor + privoxy + squid) follow
How to create an advanced proxy server using Tor, Privoxy, and Squid
I try call to Proxy cache
curl -x 'my-ip:3400' -I 'https://github.global.ssl.fastly.net/images/modules/dashboard/bootcamp/octocat_setup.png'
curl -x 'my-ip:3400' -I http://hadoop.apache.org/images/hadoop-logo.jpg
https request is ok (through Pivoxy)
HTTP/1.1 200 Connection established
Proxy-Agent: Privoxy/3.0.21
HTTP/1.1 200 OK
Date: Sat, 08 Mar 2014 04:38:37 GMT
Server: GitHub.com
Content-Type: image/png
Last-Modified: Fri, 16 Aug 2013 09:42:18 GMT
Expires: Sun, 08 Mar 2015 04:38:37 GMT
Cache-Control: max-age=31536000, public
Timing-Allow-Origin: https://github.com
Content-Length: 10722
Accept-Ranges: bytes
Via: 1.1 varnish
Age: 0
X-Served-By: cache-am72-AMS
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1394253517.449177980,VS0,VE97
Vary: Accept-Encoding
but http requets not working
HTTP/1.0 200 OK
Date: Sat, 08 Mar 2014 04:39:19 GMT
Server: Apache/2.4.8-dev (Unix) mod_wsgi/3.4 Python/2.7.5 OpenSSL/1.0.1e
Last-Modified: Tue, 12 Feb 2008 17:38:57 GMT
ETag: "24e3-445f987fe69d8"
Accept-Ranges: bytes
Content-Length: 9443
Content-Type: image/jpeg
X-Cache: MISS from SVR226L-696.localdomain
X-Cache-Lookup: MISS from SVR226L-696.localdomain:3128
Via: 1.0 SVR226L-696.localdomain (squid)
Connection: keep-alive
Please suggest a specific solution
I have an aspx web page with various Telerik RadControls on it and each time this page is loaded, Safari mobile seems to download all the resource files again - for example the following files are downloaded on each page request to an ipad - nothing seems to get cached as it would be on other non-mobile browsers.
http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1109/Common/Navigation/NavigationScripts.js
http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1109/PanelBar/RadPanelBarScripts.js
http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1109/Input/TextBox/RadInputScript.js
http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1109/ListBox/RadListBoxScripts.js
http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1109/ComboBox/RadComboBoxScripts.js
http://aspnet-scripts.telerikstatic.com/ajaxz/2010.3.1109/Grid/RadGridScripts.js
This is over 100K of javascript being passed down each time even though the CDN resources are set to cache and have ETAGS.
I've rigged up fiddler to both the ipad and a laptop running IE/FF/Safari each time the laptop browser is caching the resource files above and the ipad isn't.
I think this is why my app performs notably slower on the Ipad although it may be the slow javascipt parsing on the Ipad as well...
Has anyone else had this problem? Am i missing something obvious here?
Thanks.
EDIT
I am monitoring the iPad traffic on the laptop by making the laptop an http proxy for the iPad.
Extra Info from fiddler:
Fiddler v2.3.0.0, laptop results from IE8, iPad vers. 3.2.2.
From my laptop, If I go to http://demos.telerik.com/aspnet-ajax/listbox/examples/default/defaultcs.aspx
and after click "First Look" a few times the following in in fiddler:
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 54,608 private text/html; charset=utf-8 iexplore:6172
2 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8 iexplore:6172
4 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 54,608 private text/html; charset=utf-8 iexplore:6172
5 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8 iexplore:6172
7 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 54,608 private text/html; charset=utf-8 iexplore:6172
8 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8 iexplore:6172
10 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 54,608 private text/html; charset=utf-8 iexplore:6172
11 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8 iexplore:6172
If I do the same on my iPad the following is recorded by fiddler:
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 54,380 private text/html; charset=utf-8
2 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/Common/Navigation/NavigationScripts.js 7,856 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
3 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ComboBox/RadComboBoxScripts.js 16,238 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
4 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/Ajax/Ajax.js 7,509 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
5 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ToolBar/RadToolBarScripts.js 13,372 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
6 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8
8 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 54,380 private text/html; charset=utf-8
9 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/Common/Navigation/NavigationScripts.js 7,856 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
10 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ComboBox/RadComboBoxScripts.js 16,238 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
11 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ListBox/RadListBoxScripts.js 13,199 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
12 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8
13 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ToolBar/RadToolBarScripts.js 13,372 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
15 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 54,380 private text/html; charset=utf-8
16 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/Common/Navigation/NavigationScripts.js 7,856 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
17 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ComboBox/RadComboBoxScripts.js 16,238 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
18 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ToolBar/RadToolBarScripts.js 13,372 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
19 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/ListBox/RadListBoxScripts.js 13,199 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
20 200 HTTP aspnet-scripts.telerikstatic.com /ajaxz/2010.3.1317/Ajax/Ajax.js 7,509 public, max-age=31536000 Expires: Sun, 17 Jan 2021 15:05:25 GMT application/x-javascript
21 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8
EDIT 2:
I have tried exactly the same test as above again today and noticed that:
1) The IPad is now caching the javascript
2) Telerik demos are not using the CDN but they were yesterday! (see results below compared to results above)
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 53,036 private text/html; charset=utf-8
2 200 HTTP demos.telerik.com /aspnet-ajax/Telerik.Web.UI.WebResource.axd?compress=1&_TSM_CombinedScripts_=%3b%3bTelerik.Web.UI%2c+Version%3d2010.3.1317.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a9506cff2-3a86-46c5-b869-6ba1478f3c27%3a1c2121e%3ae8945d51%3af4636213%3ac531f12c%3a4d471440%3af7131199%3ac17ca3a3 10,599 public, max-age=31533429 Expires: Sat, 18 Feb 2012 10:06:39 GMT text/css
3 200 HTTP demos.telerik.com /aspnet-ajax/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a8f393b2b-3315-402f-b504-cd6d2db001f6%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-US%3a9506cff2-3a86-46c5-b869-6ba1478f3c27%3a16e4e7cd%3af7645509%3a24ee1bba%3af46195d3%3a1e771326%3aaa288e2d%3a628ebdd0%3a9cdfc6e7%3aed16cbdc%3a2bef5fcc%3aa7e79140 160,387 public, max-age=31533429 Expires: Sat, 18 Feb 2012 10:06:40 GMT application/x-javascript
4 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8
10 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 53,032 private text/html; charset=utf-8
11 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8
14 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 53,032 private text/html; charset=utf-8
15 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8
18 200 HTTP demos.telerik.com /aspnet-ajax/listbox/examples/default/defaultcs.aspx 53,032 private text/html; charset=utf-8
19 200 HTTP demos.telerik.com /aspnet-ajax/Common/CodeViewer.js.aspx 5,534 private text/javascript; charset=utf-8
I've just tested it with Fiddler - opened a RadListBox on a page with version 2010.3.1109 on an iPad (iOS 4.2) and it seems to me the CDN resources are cached properly and are not refreshed from the CDN every time as you are experiencing.
Can you share some more details about this issue, like a sample page or a live URL where we can test it? You can open a support ticket in your Telerik account to send those if you prefer the privacy.
EDIT:
I've also tested with 3.2.2 and I still can't reproduce this issue. Are you using some specific iPad settings or network setup worth mentioning?