• Post Reply Bookmark Topic Watch Topic
  • New Topic

Http caching  RSS feed

 
Richard Hackler
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there, this might be a really silly question but....

I'm working on writing a proxy server that does caching as well. When I get a request from the browser I get the following information trying to get to google:

GET http://www.google.com/ HTTP/1.1

http://www.google.com/
Host: www.google.com

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20130517 Firefox/21.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Cookie: PREF=ID=76a20785eb3669d2:U=7e4c66f7c64093ca:FF=1:LD=en:TM=1390512101:LM=1392232240:S=xGwdBHYJUXz5atd0; NID=67=BLJIRGarPk_ZueBKQY1qQJ0KIEquVHwpFnMJBr-K-lFREdosk8PTrITDQN_2Xji5Sj-rOf0GQXEzg6dUr7JqqjbGgOjNrBDmhosVRT7wFDLUK81Oyw0n6SiVEXXrgdhyA4RLAYDq0eBlaakfarERn6jo8rdPFzX9OOMF4f8a; OGPC=5061183-5:

Connection: keep-alive



Now from the request I need to cache something........ my question is what exactly needs to be cached? I'm imagine it's images from the site, the code for the layout, etc. But I'm struggling on understanding how to get that from the request from the browser to the server.


I'm sure it's a matter of something simple going over my head but any pointers are much appreciated!
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that's a question for you : what do you want to cache? Images, CSS, Javascript, actual page content?

You would look at the URL and the content type to determine whether or not to cache something. And, of course, the cache headers of the response :-)
 
Paul Clapham
Sheriff
Posts: 22521
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may not be aware of this, but the HTML content for a page and the images linked from that page are retrieved via separate requests, as are Javascript and CSS files. So you can (and should) consider each of those things separately when deciding whether to cache them, as indeed real-life browsers do.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!