-
Notifications
You must be signed in to change notification settings - Fork 843
Open
Labels
regex_remapregex_remap pluginregex_remap plugin
Description
Using ATS 10.1
I am trying to write a blanket http to https redirect remap rule. I did the following using both the host and pristine options of regex_remap plugin:
# RFC2606 says this tld should never resolve - destination of remap rule is unused in this configration
regex_map http://(.*) https://unused.invalid @plugin=regex_remap.so @pparam=/opt/regex_remap/plaintext-redirect.config @pparam=host @pparam=pristine
And the contents of /opt/regex_remap/plaintext-redirect.config regex_remap plugin config is the following:
^(.*)$ https://$1 @status=307
Whats interesting is that the target match string contains the // from the scheme of the pristine URL which I thought was odd:
[Nov 21 20:45:28.692] [ET_NET 10] DIAG: <regex_remap.cc:948 (TSRemapDoRemap)> (regex_remap) Target match string is `//thisisatest.yahoo.com/?foo=bar&bar=baz'
[Nov 21 20:45:28.692] [ET_NET 10] DIAG: <regex_remap.cc:1014 (TSRemapDoRemap)> (regex_remap) New URL is estimated to be 51 bytes long, or less
[Nov 21 20:45:28.692] [ET_NET 10] DIAG: <regex_remap.cc:1015 (TSRemapDoRemap)> (regex_remap) New URL is https:////thisisatest.yahoo.com/?foo=bar&bar=baz (length 48)
[Nov 21 20:45:28.692] [ET_NET 10] DIAG: <regex_remap.cc:1016 (TSRemapDoRemap)> (regex_remap) matched rule 1 [^(.*)$]
[Nov 21 20:45:28.692] [ET_NET 10] DIAG: <regex_remap.cc:1028 (TSRemapDoRemap)> (regex_remap) Redirecting URL, status=307
So the working config needs to remove the // from the destination scheme to work:
^(.*)$ https:$1 @status=307
Only with this 2nd config do I get the proper redirect.
Metadata
Metadata
Assignees
Labels
regex_remapregex_remap pluginregex_remap plugin