KO
|
EN
gitlite — search
Search
#javascript
#python
#css
#android
#typescript
#machine-learning
#docker
#react
#nodejs
#ansible
#public
#docker-compose
caddy2-filter
★ 53
Open GitHub ↗
Replace response body in caddy2
Download README (.md)
Explore Similar Repositories
authcrunch
:
Authentication Portal based on Caddy Security
caddy-wol
:
Caddy plugin that sends wake-on-lan magic packets to remote hosts to wake up e.g. reverse proxy targets.
caddy2-proxyprotocol
:
No description available.
caddy-script
:
:whale: Caddy installation script
caddy-php
:
PHP package to control your Caddy instance
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
caddy2-filter
?
Download (.md)
# caddy2-filter [](https://www.repostatus.org/#wip) [](https://godoc.org/gopkg.in/sjtug/caddy2-filter) [](https://goreportcard.com/report/github.com/sjtug/caddy2-filter) Replace text in HTTP response based on regex. Similar to [http.filter](https://caddyserver.com/v1/docs/http.filter) in Caddy 1. ## Usage Only the listed fields are supported. The replacement supports capturing groups of search_pattern (e.g. `{1}`) and caddy placeholders (e.g. `{http.request.hostport}`) Caddyfile: ```caddyfile # Add this block in top-level settings: { order filter after encode } filter { # Only process URL matching this regex path <optional, regexp pattern, default: .*> # Don't process response body larger than this size max_size <optional, int, default: 2097152> search_pattern <regexp pattern> replacement <replacement string> # Only process content_type matching this regex content_type <regexp pattern> } # If you are using reverse_proxy, add this to its config to ensure # reverse_proxy returns uncompressed body: header_up -Accept-Encoding ``` JSON config (under `apps › http › servers › routes › handle`) ```json { "handler": "filter", "max_size": <int>, "path": "<regexp>", "search_pattern": "<regexp>", "replacement: "<string>", "content_type": "<regexp>" } ``` ## Alternatives As of Jun 2021, <https://github.com/caddyserver/replace-response> can achieve similar functionalities. This plugin's design differs from that one in the following aspects: 1. This plugin supports placeholders like {http.host} 2. This plugin allows capping the max size of buffered response 3. This plugin supports only replacing responses with certain content_types 1. replace-response supports `stream` mode, which features in better performance at the cost of possibilities of omitted replacements 2. replace-response is a semi-official plugin maintained by the same author of caddy