Skip to content

Support multiple request_uri values and prevent duplicates across rules - #12

Merged
maclarel merged 4 commits into
mainfrom
copilot/update-request-uri-to-support-multiple-values
Feb 5, 2026
Merged

Support multiple request_uri values and prevent duplicates across rules#12
maclarel merged 4 commits into
mainfrom
copilot/update-request-uri-to-support-multiple-values

Conversation

Copilot AI commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Rules can now define duplicate request_uri values across files, causing ambiguous routing. Additionally, serving the same file from multiple paths requires creating separate rule files.

Changes

  • Multiple URI support: request_uri accepts both single string and array syntax. Multiple URIs use OR logic.

    rule:
      path: files/api-docs.pdf
      request_uri:
        - /docs
        - /api/docs
        - /documentation
  • Duplicate detection: Server validates request_uri uniqueness across all rules at startup and during hot reloads. Exits with FATAL error on duplicates during startup; logs error and keeps existing rules during reload.

  • Normalization helper: Added normalize_to_list() to handle single/array/None values consistently across request_uri, header_value, and source_ip fields.

Testing

Added 6 tests covering multiple URI validation, duplicate detection (single and array), empty URI handling, and integration with existing rule conditions.

Backward Compatibility

Existing single-string request_uri values continue to work unchanged.

Original prompt

It is currently possible for multiple rules files to exist that define the same request_uri value. In the event that multiple rules have the same request_uri value, the server should fail to start with a FATAL error noting that duplicate rules for an individual resource cannot exist.

To support this, request_uri should be possible to define as having multiple values. For example, if we update rules/test.yaml to support this:

Original test.yaml

rule:
  path: files/test.txt
  request_uri: /test

Updated test.yaml that allows for multiple request_uri values

rule:
  path: files/test.txt
  request_uri: 
    - /test
    - /other_path

As with other keys that have multiple associated values, these should exist as a logical OR so that requets that match all conditions of the rule will still serve the expected file.

Please generated updated code to support this, as well as associated tests and README updates.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 29, 2026 21:41
Co-authored-by: maclarel <21298298+maclarel@users.noreply.github.com>
…e tests

Co-authored-by: maclarel <21298298+maclarel@users.noreply.github.com>
Copilot AI changed the title [WIP] Update rule configuration to allow multiple request_uri values Support multiple request_uri values and prevent duplicates across rules Jan 29, 2026
Copilot AI requested a review from maclarel January 29, 2026 21:49
@maclarel
maclarel marked this pull request as ready for review February 5, 2026 20:36
@maclarel
maclarel merged commit fa5a750 into main Feb 5, 2026
3 checks passed
@maclarel
maclarel deleted the copilot/update-request-uri-to-support-multiple-values branch February 5, 2026 20:36
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