I think you actually need to check here that the requested pathname is a descendant of one of the rewrite paths, right? (It might be in a subfolder.) So you can't just look up `location.pathname` in the map--you have to look through the map and see if any of the filtered paths are a prefix of the requested path. (Which means you should probably just make the list of paths an array instead of a map.)