Skip to content

Redirect

User65k edited this page May 6, 2024 · 3 revisions

Redirect a client to some other place.

Config

Specify at least the key redirect in a mount path.

subkey meaning
redirect URL to redirect to. May be absolute, with or without host or relative. The value will be set in the Location header
code Optional int. Status code to return. Default: 301
add_req_path Optional if true, add the requested path and query. Defaults to false

Examples

Redirect requests from /stuff/ to http://other/folder/.

  • /stuff/test?abc -> http://other/folder/
  • /stuff/a/b/c -> http://other/folder/
["example.com".stuff] # /stuff/* will go to http://other/folder/
redirect = "http://other/folder/"

Keep path and query:

  • /stuff/test?abc -> http://other/folder/test?abc
  • /stuff/a/b/c -> http://other/folder/a/b/c
["example.com".stuff] # /stuff/* will go to http://other/folder/*
redirect = "http://other/folder/"
add_req_path = true

Keep host and protocol:

  • /stuff -> /folder/
["example.com".stuff] # /stuff/* will go to /folder/
redirect = "/folder/"

Clone this wiki locally