PascalMinder / geoblock

Traefik middleware plugin - Deny requests based on country of origin
105 stars 9 forks source link

Add addCountryHeader option (optionally sets X-IPCountry Request Header) #38

Closed rjmidau closed 1 year ago

rjmidau commented 1 year ago

This adds a new configuration option, which when enabled adds an additional Request header with the country code returned from cache/API.

The configuration option (addCountryHeader) is disabled by default, and the header is X-IPCountry (borrowed from Cloudflare's CF-IPCountry).

It's useful for if you want to allow backend applications to make more granular decisions about how they handle traffic from particular countries, rather than an all-or-nothing configuration in Traefik (or complicating Traefik configuration by having multiple routers and middleware instances).

resolves #10

rjmidau commented 1 year ago

@PascalMinder I've rebased this onto the current main and unit tests completed locally. Can you please re-run the workflows. Thanks

PascalMinder commented 1 year ago

I’ll look at it this weekend. Thank you.

PascalMinder commented 1 year ago

Only a small typo. Otherwise, this looks great. Thank you. I'll add it as soon as you fixed the typo.