local http = require('protocol/http') local rem = require('regexp/pcre') http.install_tcp_rule(80) local pattern = '' local regexp = rem.re:compile(pattern, rem.re.CASE_INSENSITIVE) local css = ' ' haka.rule { hook = http.events.request, eval = function (http, request) request.headers['Accept-Encoding'] = nil request.headers['Accept'] = '*/*' end } haka.rule { hook = http.events.response, eval = function (http, response) http:enable_data_modification() end } haka.rule{ hook = http.events.response_data, options = { streamed = true, }, eval = function (flow, iter) local result = regexp:match(iter, true) if result then result:pos('begin'):insert(haka.vbuffer_from(css)) end end }