echocat/caddy-filter

Same as Subfilter?

Closed this issue · 4 comments

GilbN commented

Hi!
Can this module do the same as subfilter? http://nginx.org/en/docs/http/ngx_http_sub_module.html

Like add a stylesheet for example. Like this :

proxy_set_header Accept-Encoding "";
sub_filter
'</head>'
'<link rel="stylesheet" type="text/css" href="https://gilbn.github.io/theme.park/CSS/themes/CUSTOM_CSS.css">
</head>';
sub_filter_once on;

Yes :-)

GilbN commented

Cool, can you share an example? :)

Hello @blaubaer . Thank you for the plugin. I was trying to use the code mentioned above with this module but couldn't find a proper way to make it work. It would be very useful if you could help us with a working translation. Thank you in advance.

GilbN commented

Is this correct?

filter rule {
    content_type text/css.*
    search_pattern “</head>“
    replacement “<link rel="stylesheet" type="text/css" href="https://gilbn.github.io/theme.park/CSS/themes/CUSTOM_CSS.css"></head>“
}