You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Leif Hedstrom <zw...@apache.org> on 2013/05/03 22:18:41 UTC

Re: Caching dynamic content, trading between HTTP versions

On 4/30/13 3:13 AM, Andrea Aime wrote:
> Hi,
> I'm trying to stand up a multi-level cache of dynamically generated 
> content and
> having some design issues with inconsistent version of HTTP protocol used
> before and after the cache.
>
> Basically, I have a webapp that generates dynamic content for which it's 
> possible
> to create an ETag, and handle appropriately the If-None-Modified 
> validation requests,
> but where we don't have enough information to handle a If-Modified-Since 
> request
> instead.
> So basically, we need the cache to talk HTTP 1.1 with the webapp.
>
> So far so good. Now enter a second level of caching, a CDN made with 
> cloudfront,
> and here is the gotcha: cloudfront only supports HTTP 1.0 requests towards the
> origin, which in this case would be TrafficServer.
>
> So I'm wondering, is TrafficServer able to trade between the two worlds, 
> basically
> have it so that cloudfront makes a if-modified-since validation request, and
> TrafficServer somehow turns into into a if-none-modified towards the 
> dynamic webapp?
> Pretty new to caches, so no idea if the thing is feasible at all.
>


As long as you keep the default setting, it ought to just work. Do you see 
problems with this? The setting in question is

     CONFIG proxy.config.http.send_http11_requests INT 1

-- Leif

P.s
To make sure I'm not smoking crack (this time at least...), I tried it 
(sending an HTTP/1.0 request to ATS). Below is a debug tracer from 
traffic_server, as you can see, the client request is HTTP/1.0, the proxy 
request to origin is HTTP/1.1, the response from Origin is HTTP/1.1, and 
finally, the response back to client is HTTP/1.0 (which is a must). This is 
why conforming to RFC2616 should not be considered optional ;).

+++++++++ Incoming Request +++++++++
-- State Machine Id: 0
GET http://l.yimg.com/a/lib/ycs/bench/100.bmp HTTP/1.0
User-Agent: curl/7.27.0
Host: l.yimg.com
Accept: */*

+++++++++ Proxy's Request +++++++++
-- State Machine Id: 0
GET /a/lib/ycs/bench/100.bmp HTTP/1.1
User-Agent: curl/7.27.0
Host: l.yimg.com
Accept: */*
Client-ip: 192.168.201.14
X-Forwarded-For: 192.168.201.14
Via: http/1.0 loki.ogre.com[FE8000000000000002016CFFFE63288A] (ApacheTrafficServer/3.3.3-dev)

+++++++++ Incoming O.S. Response +++++++++
-- State Machine Id: 0
HTTP/1.1 200 OK
Date: Fri, 03 May 2013 20:17:11 GMT
Cache-Control: max-age=315360000
Expires: Mon, 01 May 2023 20:17:11 GMT
Last-Modified: Thu, 11 Mar 2010 23:55:10 GMT
Accept-Ranges: bytes
Content-Length: 100
Content-Type: image/bmp
Age: 0
Connection: keep-alive
Via: http/1.1 l14.ycs.mud.yahoo.com (ApacheTrafficServer/3.2.0)
Server: ATS/3.2.0

[May  3 14:17:11.722] Server {0x7f53c06fe700} DEBUG: (http_hdrs) [initialize_state_variables_from_response]Server is keep-alive.
+++++++++ Cached Request Hdr +++++++++
-- State Machine Id: 0
GET http://l.yimg.com/a/lib/ycs/bench/100.bmp HTTP/1.1
User-Agent: curl/7.27.0
Host: l.yimg.com
Accept: */*
Client-ip: 192.168.201.14
X-Forwarded-For: 192.168.201.14

+++++++++ Base Header for Building Response +++++++++
-- State Machine Id: 0
HTTP/1.1 200 OK
Date: Fri, 03 May 2013 20:17:11 GMT
Cache-Control: max-age=315360000
Expires: Mon, 01 May 2023 20:17:11 GMT
Last-Modified: Thu, 11 Mar 2010 23:55:10 GMT
Accept-Ranges: bytes
Content-Length: 100
Content-Type: image/bmp
Age: 0
Connection: keep-alive
Via: http/1.1 l14.ycs.mud.yahoo.com (ApacheTrafficServer/3.2.0)
Server: ATS/3.2.0

+++++++++ Proxy's Response 2 +++++++++
-- State Machine Id: 0
HTTP/1.0 200 OK
Date: Fri, 03 May 2013 20:17:11 GMT
Cache-Control: max-age=315360000
Expires: Mon, 01 May 2023 20:17:11 GMT
Last-Modified: Thu, 11 Mar 2010 23:55:10 GMT
Accept-Ranges: bytes
Content-Length: 100
Content-Type: image/bmp
Age: 0
Via: http/1.1 l14.ycs.mud.yahoo.com (ApacheTrafficServer/3.2.0)
Server: ATS/3.3.3-dev


Re: Caching dynamic content, trading between HTTP versions

Posted by Andrea Aime <an...@geo-solutions.it>.
On Fri, May 3, 2013 at 10:18 PM, Leif Hedstrom <zw...@apache.org> wrote:

> As long as you keep the default setting, it ought to just work. Do you see
>> problems with this? The setting in question is
>>
>
>     CONFIG proxy.config.http.send_http11_**requests INT 1
>

Wow, now that looks good (simple and works).


>
> -- Leif
>
> P.s
> To make sure I'm not smoking crack (this time at least...), I tried it
> (sending an HTTP/1.0 request to ATS). Below is a debug tracer from
> traffic_server, as you can see, the client request is HTTP/1.0, the proxy
> request to origin is HTTP/1.1, the response from Origin is HTTP/1.1, and
> finally, the response back to client is HTTP/1.0 (which is a must). This is
> why conforming to RFC2616 should not be considered optional ;).
>

I'll double check for sure, but the traces you provided really seem
promising. What I need to test is what happens if the
origin server responds with an etag.

Cheers
Andrea

-- 
==
GeoServer training in Milan, 6th & 7th June 2013!  Visit
http://geoserver.geo-solutions.it for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------