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

Enable support for slashes in regex when doing a rewrite.

Open kristof-mattei opened this issue 4 years ago • 1 comments

serve.json:

{
    "rewrites": [
        {
            "source": "foo/:rest*",
            "destination": "/:rest*"
        }
    ]
}

If we were to query localhost:5000/foo/bar/quz/cux.json fallback would end up being /bar%2Fquz%2Fcux.json which is never found by the stat function.

This commit fixes that.

Why did I do this?

I have a site hosted at http://foo.com/bar, which is actually a reverse proxy to a container running zeit/serve. zeit/serve doesn't know that it's supposed to discard bar, as it thinks it's at the root.

Now with the rewrite, that is fixed.

Edit: this seems to be triggering some errors. Let me find out why.

kristof-mattei avatar Nov 19 '19 01:11 kristof-mattei

Bump

crutch12 avatar Aug 31 '21 14:08 crutch12