Fix middleware request resource path

Don't assume req.path starts with /resource/.