diff --git a/src/Scarf/Gateway/Rule.hs b/src/Scarf/Gateway/Rule.hs index 9209d34..31000e7 100644 --- a/src/Scarf/Gateway/Rule.hs +++ b/src/Scarf/Gateway/Rule.hs @@ -846,7 +846,7 @@ matchPixel PixelRule {..} Request {requestWai} | otherwise = pure Nothing --- | Match a catch-all rule. In its current form the only thing it does is redirect a request +-- | Match a catch-all rule. In its current form the only thing it does is redirect a request -- to separate domain. Something that, in the past, has been done using file rules and catch-all -- patterns like /{+path}. While effective URI templates are not great at dealing with encoding -- specifics. @@ -861,9 +861,7 @@ matchCatchAllV1 CatchAllRuleV1 {..} Request {requestWai} let !absoluteUrl = LBS.toStrict $ toLazyByteString $ - -- Just using the protocol that the request came in with - -- allows for convenient testing. - (if Wai.isSecure requestWai then "https://" else "http://") + "https://" <> Text.encodeUtf8Builder targetDomain <> ( -- We would just like to use encodePath which is provided by http-types diff --git a/test/golden/catch-all-1.output.yaml b/test/golden/catch-all-1.output.yaml index b6a0344..575f8d0 100644 --- a/test/golden/catch-all-1.output.yaml +++ b/test/golden/catch-all-1.output.yaml @@ -1,10 +1,10 @@ capture: |- Just FlatfileCapture - { fileAbsoluteUrl = Just "http://downloads.test.sh/hello%20world" + { fileAbsoluteUrl = Just "https://downloads.test.sh/hello%20world" , fileVariables = fromList [] , filePackage = "8717953c-3452-4ef7-9a14-b64dc19163b4" } headers: - Location: http://downloads.test.sh/hello%20world + Location: https://downloads.test.sh/hello%20world status: 302 diff --git a/test/golden/catch-all-2.output.yaml b/test/golden/catch-all-2.output.yaml index 0026b93..0eb1002 100644 --- a/test/golden/catch-all-2.output.yaml +++ b/test/golden/catch-all-2.output.yaml @@ -2,11 +2,11 @@ capture: |- Just FlatfileCapture { fileAbsoluteUrl = - Just "http://downloads.test.sh/search?q=hello%20world" + Just "https://downloads.test.sh/search?q=hello%20world" , fileVariables = fromList [] , filePackage = "8717953c-3452-4ef7-9a14-b64dc19163b4" } headers: - Location: http://downloads.test.sh/search?q=hello%20world + Location: https://downloads.test.sh/search?q=hello%20world query: ?q=hello%20world status: 302