Author Topic: Transport-Encoding is Chunked messes up my Limelight Caching  (Read 3556 times)

Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
Hi guys,

I have Limelight caching my objects.  One of the files is going to them Chunked, which is a standard HTTP 1.1 method.  Unfortunately, this causes LL to not deliver it at all because it requires Content-Length header to be available.

I know Oracle has put together a nice document on how to use Rewrite to remove the Chunked by converting to HTTP 1.0.  I would much rather not convert to HTTP 1.0.  Is there any way I could have the NetScaler inject the Content-Length value to the file being delivered while it's still going out as Chunked and as HTTP 1.1?

Thanks!
JM

Offline evildani

  • Administrator
  • Hero Member
  • *****
  • Posts: 389
  • Karma: 22
Why do you rather stick with http 1.1?

Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
For several reasons, but the primary one is with caching options and headers available only in HTTP 1.1, such as Cache-Control.  I think HTTP 1.0 has the Expires header for caching.

Offline evildani

  • Administrator
  • Hero Member
  • *****
  • Posts: 389
  • Karma: 22
I asked Oracle a while back the differences on 1.1 and 1.0, and he told be that the netscaler has no regard on the http version used and the changes are minimal with no real effect, on the other hand you do the cache on the NS and the response to the client is sent on 1.1, so all cache headers are set by the NS. Unless you use cache redirection?
Or you could write a rewrite rule only for that GET, can you?

Daniel

Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
I am hesitant to make a switch from 1.1 to 1.0, do a few rewrite rules, and mak major changes just to fix one simple issue.  It could end up getting me in much worse shape going that route.  ;)

Offline evildani

  • Administrator
  • Hero Member
  • *****
  • Posts: 389
  • Karma: 22
But maybe you can pin-point the exact GET for that particular request and write a rewrite rule for only that request, so only that would be requested using http 1.0, and all other traffic be requested over 1.1.
If you want I would gladly help you.

Daniel

Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
That would be great, thanks!  Let's assume the URL is:
http://www.domain.com/Directory/File.js

Just as an FYI, the GET of this file could contain variables, such as
Code: [Select]
http://www.domain.com/Directory/File.js?var=valuexxx where xxx changes a lot.

JM

Offline evildani

  • Administrator
  • Hero Member
  • *****
  • Posts: 389
  • Karma: 22
you are using NS 7.0 right? I use 8.1.... that could be a problem....

Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
Oh yeah, I use 7.1.  I think rewrite is still doable in 7.1.  8+ allows for body rewrite, but we're not doing that here.

Offline evildani

  • Administrator
  • Hero Member
  • *****
  • Posts: 389
  • Karma: 22
Try this please:

add rewrite action downgrade_1.0 replace http.req.version "\"HTTP/1.0\""

add rewrite policy testtO_1.0 "HTTP.REQ.URL.EQ(\"/Directory/Page.js\") || HTTP.REQ.URL.QUERY.LENGTH.GT(0) || CLIENT.IP.SRC.EQ(10.10.10.10) || HTTP.REQ.METHOD.EQ(GET) " downgrade_1.0

bind rewrite global testto_1.0 10 NEXT -type REQ_DEFAULT

Please change you IP to your own IP so the rewite will only be applied to you.
Tell me how it behaves...
Daniel


Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
Thanks, Daniel.  I noticed you were using OR (||) and not AND (&&) in your policy.  I changed those to &&.

The interesting thing here is that the file came back as follows:
Code: [Select]
HTTP/1.1 400 Bad Request
Content-Type: text/html
Date: Wed, 16 Jul 2008 23:31:55 GMT
Connection: close
Content-Length: 20

<h1>Bad Request</h1>

I was able to confirm that my hit got the policy's counter to increment, so the issue must be with the action.  Could you verify the action you gave me?  I'm not an expert with rewrite.

JM

Offline evildani

  • Administrator
  • Hero Member
  • *****
  • Posts: 389
  • Karma: 22
Yes I meant && sorry...
There was no error when you inserted the policy? You did that on the CLI right?

BTW I used the same action that Oracle uses...

I just saw another typo on the policy I gave you, the policy name testdowngradeTo_1.0 so match it on the bind.

Can you use fiddler to make a custom request to the server just to verify that http 1.0 is supported?

Daniel


Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
Daniel,

Sorry, I had a typo in the action.  I was using the GUI and didn't notice the extra characters that are required for the CLI.  I removed that and I was able to get the file.  The problem is I'm still seeing it as 1.1 and chunked...

I'm getting tired :)

Offline evildani

  • Administrator
  • Hero Member
  • *****
  • Posts: 389
  • Karma: 22
That means that the chunked part is between you and the netscaler.... Is the chunked part still messing up the transfer?

Maybe I miss understood your problem... The object that is cached needs to know the content length in order to be cached, right? So all communication has to be unchunked in order to be cached... right? Could you make a ascii diagram?

If chunked encoding is used then content-length is discarded since the content-length is not a reliable number, in other words they are mutually exclusive.

Daniel

Offline jmelika

  • Administrator
  • Hero Member
  • *****
  • Posts: 341
  • Karma: 7
Danie,

You got it.  Limelight requires Content-Length header to be available in order to cache it.  That header is discarded as you said because the file is chunked.  I don't know whether or not the chunking is happening between the server and the NS or the NS and me (as client).  How can I find out?