mwrock / RequestReduce

Instantly makes your .net website faster by reducing the number and size of requests with almost no effort.
www.requestreduce.org
Apache License 2.0
228 stars 49 forks source link

Response filter execution order #203

Closed ysimpson closed 12 years ago

ysimpson commented 12 years ago

I've tried to find some documentation around this but couldn't find anything that answered it so hopefully this is the right place to ask the question!

We already have a couple response filters running and like a lot of examples floating around, they get assigned on BeginRequest, which seems to cause some issues when run in conjunction with RequestReduce.

I was just wondering why RequestReduce tries to install a filter on different events and why specifically ReleaseRequestState and PreSendRequestHeaders.

If we run our filters a bit later, it works okay. Quite happy to change this but looking to understand why this is happening and the design of RR a bit better.

Thanks in advance.

mwrock commented 12 years ago

rr attaches later in the request lifecycle because it wants to know if the response content type will be html or xhtml. this means that it will filter the response before filters attaced in begin request sine the filter chaining is lifo. you can manually use the rr api to attach the rr filter before your own. see the api wiki to find out how.