[GH-ISSUE #518] GeoBlock per Resource #1485

Closed
opened 2026-04-16 08:08:31 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Sf298 on GitHub (Apr 12, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/518

Issue Description

Hello! I am loving the GeoBlock plugin, however there are some Resources that I do want to expose to the global community. This does not seem to be currently possible

Ideal Solution

It would be amazing if, once the GeoBlock plugin is enabled, we could have a new option in the "Match Type" dropdown in the Resource > Rules section. The new option could be called 'Countries', and accept a comma separated list of country codes.

More Realistic Solution

If it is difficult to update the UI to handle this, then we could use a custom version of the GeoBlock plugin (or create a PR to enhance GeoBlock), that lets you apply different filters based on subdomain.

Implementation Suggestion

Looking at it's code, it seems easy to modify GeoBlock to add the ability to consider subdomains (by checking the URL parameter of the http.Request, in the allowDenyIPAddress functions).
I am quite keen on finding some kind of per Resource geo-blocking solution, so let me know if you need help with the plugin and I'll try to find the time.

Originally created by @Sf298 on GitHub (Apr 12, 2025). Original GitHub issue: https://github.com/fosrl/pangolin/issues/518 ## Issue Description Hello! I am loving the GeoBlock plugin, however there are some Resources that I do want to expose to the global community. This does not seem to be currently possible ## Ideal Solution It would be amazing if, once the GeoBlock plugin is enabled, we could have a new option in the "Match Type" dropdown in the Resource > Rules section. The new option could be called 'Countries', and accept a comma separated list of country codes. ## More Realistic Solution If it is difficult to update the UI to handle this, then we could use a custom version of the GeoBlock plugin (or create a PR to enhance GeoBlock), that lets you apply different filters based on subdomain. ## Implementation Suggestion Looking at it's code, it seems easy to modify GeoBlock to add the ability to consider subdomains (by checking the URL parameter of the http.Request, in the allowDenyIPAddress functions). I am quite keen on finding some kind of per Resource geo-blocking solution, so let me know if you need help with the plugin and I'll try to find the time.
Author
Owner

@hhftechnology commented on GitHub (Apr 14, 2025):

https://forum.hhf.technology/t/enhancing-your-pangolin-deployment-with-middleware-manager/

With this you can set it per resources any middlwares

https://github.com/hhftechnology/middleware-manager

<!-- gh-comment-id:2800419892 --> @hhftechnology commented on GitHub (Apr 14, 2025): https://forum.hhf.technology/t/enhancing-your-pangolin-deployment-with-middleware-manager/ With this you can set it per resources any middlwares https://github.com/hhftechnology/middleware-manager
Author
Owner

@mightyjens commented on GitHub (Apr 14, 2025):

This is so good, @hhftechnology !

My geoblocking-template:

traefik_config.yml

experimental:
  plugins:    
    geoblock:
      moduleName: github.com/PascalMinder/geoblock
      version: v0.3.2
    # ...

templates.yaml

 middlewares:
  # ...
  - id: "geoblock"
    name: "Geoblock"
    type: "plugin"
    config:
      geoblock:
        silentStartUp: false
        allowLocalRequests: false
        logLocalRequests: false
        logAllowedRequests: false
        logApiRequests: false
        api: "https://get.geojs.io/v1/ip/country/{ip}"
        apiTimeoutMs: 750
        cacheSize: 15
        forceMonthlyUpdate: false
        allowUnknownCountries: false
        unknownCountryApiResponse: "nil"
        blackListMode: false
        addCountryHeader: false
        countries:
          - DE
<!-- gh-comment-id:2800894564 --> @mightyjens commented on GitHub (Apr 14, 2025): This is so good, @hhftechnology ! My geoblocking-template: traefik_config.yml ``` traefik_config.yml experimental: plugins: geoblock: moduleName: github.com/PascalMinder/geoblock version: v0.3.2 # ... ``` templates.yaml ``` templates.yaml middlewares: # ... - id: "geoblock" name: "Geoblock" type: "plugin" config: geoblock: silentStartUp: false allowLocalRequests: false logLocalRequests: false logAllowedRequests: false logApiRequests: false api: "https://get.geojs.io/v1/ip/country/{ip}" apiTimeoutMs: 750 cacheSize: 15 forceMonthlyUpdate: false allowUnknownCountries: false unknownCountryApiResponse: "nil" blackListMode: false addCountryHeader: false countries: - DE ```
Author
Owner

@hhftechnology commented on GitHub (Apr 14, 2025):

glad it worked for you

<!-- gh-comment-id:2801831890 --> @hhftechnology commented on GitHub (Apr 14, 2025): glad it worked for you
Author
Owner

@hhftechnology commented on GitHub (Apr 17, 2025):

@miloschwartz please close this as well

<!-- gh-comment-id:2811784409 --> @hhftechnology commented on GitHub (Apr 17, 2025): @miloschwartz please close this as well
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#1485