djcarlin opened a new issue, #12691:
URL: https://github.com/apache/trafficserver/issues/12691

   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to