serve-handler icon indicating copy to clipboard operation
serve-handler copied to clipboard

Redirect with source "file" path not working correctly to destination

Open Awatatah opened this issue 5 years ago • 1 comments

Hello Example: Say I have this redirect

{
    "redirects": [
        { "source": "/some/old-path.html", "destination": "/new-path", "type": 301 }
    ]
}

The result is

HTTP/1.1 301 Moved Permanently
Location: /some/old-path
Date: Fri, 31 Jan 2020 03:39:03 GMT
Connection: keep-alive

instead expected result

HTTP/1.1 301 Moved Permanently
Location: /new-path
Date: Fri, 31 Jan 2020 03:39:03 GMT
Connection: keep-alive

serve version 11.3.0

Awatatah avatar Jan 31 '20 04:01 Awatatah

fyi:

  1. request: GET /some/old-path.html
    response: Location: /some/old-path
    cause: config.cleanUrls
  2. request: GET /some/old-path
    response: Location: /some/old-path/
    cause: config.trailingSlash

to match any of the possible resulting locations (depending on config):

{
    "redirects": [
        { "source": "/some/old-path*", "destination": "/new-path" }
    ]
}

warren-bank avatar Feb 16 '22 01:02 warren-bank