Skip to content

Wildcard domain rule takes precedence over exact domain rule #354

Description

@kuaifan

Hi, first of all, thanks for maintaining this project.

I encountered a domain matching priority issue when using HTTP/HTTPS host forwarding.

Current setup

Example rules:

*.example.com            -> 127.0.0.1:80
gateway.example.com      -> another target

Both rules are configured in NPS.

Expected behavior

Exact domain rules should have higher priority than wildcard rules.

For example:

gateway.example.com

should match the exact rule first, instead of being captured by:

*.example.com

This is the behavior used by many reverse proxies/load balancers such as nginx, Traefik, Caddy, etc.

Actual behavior

The wildcard rule:

*.example.com

captures the request first.

The exact rule:

gateway.example.com

never takes effect.

Environment

  • nps fork: djylb/nps
  • HTTPS enabled
  • TLS termination enabled
  • ECS + npc + reverse proxy architecture

Suggestion

It would be great if NPS could:

  1. Automatically prioritize exact domain matches over wildcard matches
  2. Or provide configurable rule priority/order
  3. Or document the current matching behavior clearly

This becomes important when using wildcard domains as a generic gateway entry, while reserving several exact domains for infrastructure or management services.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions