Files
mox/testdata/webserver/domains.conf
Mechiel Lukkien 8b0706e02d for WebRedirect, don't "match" when the destination URL has the same scheme,host,path, for doing http -> https redirects without loops
you can already get most http to https redirects through DontRedirectPlainHTTP
in WebHandler, but that needs handlers for all paths.

now you can just set up a redirect for a domain and all its path to baseurl
https://domain (leaving other webdirect fields empty). when the request comes
in with plain http, the redirect to https is done. that next request will also
evaluate the same redirect rule. but it will not cause a match because it would
redirect to the same scheme,host,path. so next webhandlers get a chance to
serve.

also clarify in webhandlers docs that also account & admin built-in handlers
run first.

related to issue #16
2023-03-08 23:29:44 +01:00

93 lines
2.0 KiB
Plaintext

Domains:
mox.example:
LocalpartCaseSensitive: false
Accounts:
mjl:
Domain: mox.example
Destinations:
mjl: nil
WebDomainRedirects:
redir.mox.example: mox.example
WebHandlers:
-
LogName: redirhttps
Domain: schemeredir.example
PathRegexp: ^/
DontRedirectPlainHTTP: true
WebRedirect:
BaseURL: https://schemeredir.example
-
LogName: static
Domain: mox.example
PathRegexp: ^/static/
DontRedirectPlainHTTP: true
WebStatic:
# This is run from the http package.
Root: ../testdata/web
ListFiles: true
ResponseHeaders:
X-Test: mox
-
LogName: nolist
Domain: mox.example
PathRegexp: ^/nolist/
DontRedirectPlainHTTP: true
WebStatic:
StripPrefix: /nolist/
# This is run from the http package.
Root: ../testdata/web/static
-
LogName: httpsredir
Domain: mox.example
PathRegexp: ^/tls/
WebStatic:
# This is run from the http package.
Root: ../testdata/web/static
-
LogName: baseurlonly
Domain: mox.example
PathRegexp: ^/baseurl/
DontRedirectPlainHTTP: true
WebRedirect:
BaseURL: https://tls.mox.example?q=1#fragment
-
LogName: pathonly
Domain: mox.example
PathRegexp: ^/pathonly/
DontRedirectPlainHTTP: true
WebRedirect:
OrigPathRegexp: ^/pathonly/old/(.*)$
ReplacePath: /pathonly/new/$1
StatusCode: 307
-
LogName: baseurlpath
Domain: mox.example
PathRegexp: ^/baseurlpath/
DontRedirectPlainHTTP: true
WebRedirect:
BaseURL: //other.mox.example?q=1#fragment
OrigPathRegexp: ^/baseurlpath/old/(.*)$
ReplacePath: /baseurlpath/new/$1
# test code depends on these last two webhandlers being here.
-
LogName: strippath
Domain: mox.example
PathRegexp: ^/strip/
DontRedirectPlainHTTP: true
WebForward:
StripPath: true
# replaced while testing
URL: http://127.0.0.1:1/a
ResponseHeaders:
X-Test: mox
-
LogName: nostrippath
Domain: mox.example
PathRegexp: ^/nostrip/
DontRedirectPlainHTTP: true
WebForward:
# replaced while testing
URL: http://127.0.0.1:1/a
ResponseHeaders:
X-Test: mox