Add parameter to configure the ban page Content-Type response header (#325)

* Add parameter to configure Ban Response Content-Type

* Add testing for new BanResponseContentType parameter

* Ensure there is a fallback to default Content-Type is user provided empty value

* Set Content-Type even if banTemplate is nil

* Add more edge cases for testing ban response Content-Type

* Add CR/LF validation for BanResponseContentType

* Add CaptchaResponseContentType to allow separate Content-Type configuration for captcha responses

* Add testing for new CaptchaResponseContentType

* Update README

* Split nil and CR/LF response Content-Type value validation into separate function

* Throw error instead of setting the default in case of empty parameter declaration

* Update testing accordingly

*  remove HTML from var name, add tests and infer content type from filePath

* 🍱 fix lint ?

* 🍱 fix lint

* 🍱 fix lint

* 🍱 fix lint + naming

* 🍱 fix lint

* 🍱 fuck lint

---------

Co-authored-by: maxlerebourg <maxlerebourg@gmail.com>
This commit is contained in:
omer
2026-06-28 22:30:48 +02:00
committed by GitHub
co-authored by maxlerebourg
parent f4dcd933c8
commit 7c73cb38dd
14 changed files with 168 additions and 63 deletions
+4 -4
View File
@@ -513,14 +513,14 @@ make run
- int64
- default: 1800 (= 30 minutes)
- Period after validation of a captcha before a new validation is required if Crowdsec decision is still valid
- CaptchaHTMLFilePath
- CaptchaFilePath
- string
- default: /captcha.html
- Path where the captcha template is stored
- BanHTMLFilePath
- Path where the captcha template is stored. The Content-Type header is automatically inferred from the file extension.
- BanFilePath
- string
- default: ""
- Path where the ban html file is stored (default empty ""=disabled)
- Path where the ban file is stored (default empty ""=disabled). The Content-Type header is automatically inferred from the file extension.
- TraceHeadersCustomName
- string
- default: ""