Skip to content

Add excludedPathPatterns for bypassing geoblock checks#107

Merged
PascalMinder merged 2 commits into
PascalMinder:mainfrom
taylorgibb:main
Dec 31, 2025
Merged

Add excludedPathPatterns for bypassing geoblock checks#107
PascalMinder merged 2 commits into
PascalMinder:mainfrom
taylorgibb:main

Conversation

@taylorgibb

Copy link
Copy Markdown
Contributor

Introduces the excludedPathPatterns config option, allowing requests matching specified regex patterns (against the full domain+path) to bypass all geoblock checks. Updates the middleware logic, configuration, and documentation, and adds comprehensive tests for various exclusion scenarios and invalid patterns.

Just for some context, this is is useful when you have multiple sites behind a proxy, but one of them needs to accept webhooks for example. In my specific setup, i am running geoblock on a https://coolify.io server, one of the features is automatic LetsEncrypt cert generation, but with geoblock enabled, it wont generate the certs and they dont have a list of hosts to exclude. Another site i am running, requires webhooks for whatsapp messages, again the provider doesnt specify their hosts so i would like to allow all traffic.

Introduces the excludedPathPatterns config option, allowing requests matching specified regex patterns (against the full domain+path) to bypass all geoblock checks. Updates the middleware logic, configuration, and documentation, and adds comprehensive tests for various exclusion scenarios and invalid patterns.
@PascalMinder

Copy link
Copy Markdown
Owner

Thanks for your contribution @taylorgibb. Could you only fix the following:

Error: geoblock.go:657:53: unused-parameter: parameter 'logger' seems to be unused, consider removing or renaming it as _ (revive) func compileExcludedPathPatterns(patterns []string, logger *log.Logger) ([]*regexp.Regexp, error) {

@taylorgibb

Copy link
Copy Markdown
Contributor Author

@PascalMinder noted, will do this evening! Thanks for the review!

@taylorgibb

Copy link
Copy Markdown
Contributor Author

Hi @PascalMinder i have pushed the change to remove the unused param and run the tests again, all looks good. Would you please take another look when you get a gap ?

@PascalMinder PascalMinder self-assigned this Dec 31, 2025
@PascalMinder
PascalMinder self-requested a review December 31, 2025 15:26
@PascalMinder

Copy link
Copy Markdown
Owner

Thank you for your contribution. Looks good to me.

@PascalMinder
PascalMinder merged commit 24ed516 into PascalMinder:main Dec 31, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants