Skip to content

input path rule in config.toml and the CLI - #793

Merged
FlorentinDUBOIS merged 1 commit into
0.14from
0.14-path_rule
Sep 12, 2022
Merged

FlorentinDUBOIS merged 1 commit into
0.14from
0.14-path_rule

Conversation

@Keksoj

@Keksoj Keksoj commented Aug 26, 2022

Copy link
Copy Markdown

Up until now the proxy logic of Sōzu did enforce a PathRule when accepting requests on a frontend:

/// A filter for the path of incoming requests
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum PathRule {
    /// filters paths that start with a pattern, typically "/api"
    Prefix(String),
    /// filters paths that match a regex pattern
    Regex(String),
    /// filters paths that exactly match a pattern, no more, no less
    Equals(String),
}

(comments added in this PR)

but it would only effectively apply the Prefix path rule, that was applied by default.

This PR ensures this path rule can be input in the config.toml:

frontends = [
  { address = "0.0.0.0:8080", hostname = "lolcatho.st", tags = { key = "value" }, path = "/[a-z]{3}", path_type = "REGEX" },
]

And in the command line

sozu --config config.toml frontend http add --address 0.0.0.0:8080 --hostname lolcatho.st  --path-equals api id MyCluster

This should please @miton18 I've been told.

@Keksoj
Keksoj requested a review from FlorentinDUBOIS August 26, 2022 15:21
@Keksoj Keksoj self-assigned this Aug 26, 2022
@Keksoj Keksoj added this to the v0.14.0 milestone Aug 26, 2022
@Keksoj
Keksoj changed the base branch from main to 0.14 August 26, 2022 15:21
@FlorentinDUBOIS
FlorentinDUBOIS merged commit cc900d6 into 0.14 Sep 12, 2022
@FlorentinDUBOIS
FlorentinDUBOIS deleted the 0.14-path_rule branch September 12, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants