Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Host URI support for the URL Redirects feature #301

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

joseluisq
Copy link
Collaborator

@joseluisq joseluisq commented Jan 9, 2024

Description

This PR adds support for optional Host URI redirects via the advanced configuration.
If a host redirect setting is specified then SWS will attempt to match the value against the incoming URI host (request), applying the required redirect entry or ignoring it otherwise.

This feature will allow users for instance to perform www to non-www redirects or vice versa.

Config

[advanced]

[[advanced.redirects]]
# Optional `host` redirect to be matched against the incoming host URI
host = "127.0.0.1:4433"
# Required redirect settings
source = "/{*}"
destination = "https://localhost:4433/$1"
kind = 301

Related Issue

Motivation and Context

Due to some users asking for host-based redirection.

How Has This Been Tested?

Integration tests

Screenshots (if appropriate):

which allows redirecting based on a host's incoming uri making it
possible to perform for example www to non-www redirects.

config example:

```toml
[advanced]

[[advanced.redirects]]
host = "127.0.0.1:4433"
source = "/{*}"
destination = "https://localhost:4433/$1"
kind = 301
```
@joseluisq joseluisq added enhancement New feature or request v2 v2 release advanced-feature Advanced feature only available via the configuration file labels Jan 9, 2024
@joseluisq joseluisq self-assigned this Jan 9, 2024
@t-e-s-tweb
Copy link

Thank you for the quick resolution. Confirmed working.

@joseluisq joseluisq merged commit 8c6ab53 into master Jan 15, 2024
24 checks passed
@joseluisq joseluisq deleted the feat-host-uri-redirects branch January 15, 2024 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advanced-feature Advanced feature only available via the configuration file enhancement New feature or request v2 v2 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants