Commit e1cc737
authored
Add IP remediation fallback when remediation variable not set (#86)
Add IP remediation fallback when crowdsec-ip message not received
When HAProxy is behind an upstream proxy and only fires on-frontend-http-request,
the crowdsec-ip message may not set the remediation variable. This adds fallback
logic to check IP remediation directly in handleHTTPRequest when needed.
Changes:
- Extract IP checking logic into shared getIPRemediation() function (DRY)
- Add checkIPRemediation() fallback in handleHTTPRequest
- Include src-ip in crowdsec-http message args for fallback scenario
- Refactor handleIPRequest to use shared getIPRemediation() function
This enables configurations where crowdsec-http can work standalone with
req.hdr_ip() to extract real client IP from proxy headers.1 parent 8b2b251 commit e1cc737
2 files changed
+42
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| |||
493 | 496 | | |
494 | 497 | | |
495 | 498 | | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
510 | 503 | | |
511 | 504 | | |
512 | 505 | | |
513 | 506 | | |
514 | 507 | | |
515 | | - | |
| 508 | + | |
516 | 509 | | |
517 | 510 | | |
518 | 511 | | |
| |||
537 | 530 | | |
538 | 531 | | |
539 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
540 | 546 | | |
541 | 547 | | |
542 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
543 | 567 | | |
544 | 568 | | |
545 | 569 | | |
| |||
0 commit comments