Redirect

Returns a 3xx redirect without contacting any upstream

Category: Practical
Task: Returns a 3xx redirect without contacting any upstream

Prerequisites: The product runtime and any backend services referenced by this configuration.

Run it: Use ghcr.io/praxis-proxy/praxis:0.7.2 and follow the first reverse-proxy tutorial to mount and start the configuration.

This configuration comes from the selected release. The example has not been run here; external services are not bundled.

Download the source file.

# Redirect
#
# Returns a 3xx redirect without contacting any upstream.
# Useful for scheme upgrades (HTTP to HTTPS), domain
# migrations, or path reorganization.
#
# The location template supports ${path} and ${query}
# placeholders from the original request URI.
#
listeners:
  - name: https_upgrade
    address: "127.0.0.1:8080"
    filter_chains:
      - https_upgrade

  - name: domain_migration
    address: "127.0.0.1:8081"
    filter_chains:
      - domain_migration

filter_chains:
  - name: https_upgrade
    filters:
      - filter: redirect
        status: 301
        location: "https://example.com${path}"

  - name: domain_migration
    filters:
      - filter: redirect
        status: 308
        location: "https://new.example.com${path}${query}"