Pre-requisite:
·
Setup a cloud service (in VM*) :- <mycloudapp>.cloudapp.net
·
Setup CDN :- <mycdn>.vo.msecnd.net
o Select
origin domain as Cloud Service <mycloudapp>
o Pay
attention to “Enable Query String”
o Optionally
pay attention to “Enable HTTPS”
o Optionally
pay attention to Manage Domains
·
Browser with a either a plugin or a
request/response capture tool **
(*) à
Should work with Cloud PaaS as well.
(**) à
FireFox LiveHttpHeader, Fiddler for IE, WireShark, etc.
Steps:
1.
Setup up content:
a. Directory
structure :- <wwwroot>/cdn/images/ (“/cdn” makes CDN
communicate with Cloud Service
b. Content
:- apple.jpg (or any image of your choice J)
c. Html
content :- edit index.html (<img src="http://< mycdn>.vo.msecnd.net/images/apple.jpg"
alt="Red Delicious Apple" height="100"
width="100">) (“http” or “https” :- take care. Azure CDN doesn’t support
custom domain with SSL)
2.
Check live httpd log :- tail -f
/var/log/httpd/access_log
3.
Launch a FireFox browser
4.
Launch Browser Req/Res :- In FireFox use
HttpLiveHeader
a. Check
httpd log (#2) :- Should two requests
i. <some ip> - - [<timestampe>] "GET /index.html?v=1 HTTP/1.1" 200
113 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0)
Gecko/20100101 Firefox/35.0"
ii. <some ip> - - [<timestampe>] "GET /cdn/images/apple.jpg HTTP/1.1"
200 721759 "http://dpasuswest.cloudapp.net/index.html?asdfasdf"
"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101
Firefox/35.0"
b. Check
Browser Req/res log (#4)
i. Ensure
that there two req/res one for <mycloudapp>
host and the other for < mycdn>
a. You
will notice that Browser doesn’t send any request to <mycloudapp> because
its cached J
(We got hit by browser cache Yikes...)
7.
View source and collect the CDN URL (http://<mycdn>.vo.msecnd.net/images/apple.jpg)
a. You
will notice that httpd log registered a request with the above url.
a. You
will notice that httpd log doesn’t show any request
b. You
will get a 304 from <mycdn> (Content
is served from CDN).
nice blog..
ReplyDeleteMicrosoft Azure Online Training