Fix edge rewrite handling (#40115)
Fix edge rewrite handling (#40115)

Follow-up to https://github.com/vercel/next.js/pull/40076 this ensures we handle rendering correctly when the URL doesn't match the edge function exactly e.g. when rewriting since it looks like we don't currently have access to the `x-matched-path` header like we do for serverless functions. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

Fixes: https://github.com/vercel/next.js/runs/8102187444?check_suite_focus=true

Co-authored-by: Jiachi Liu <08a5564a79b3d56562ff091aa4077e9abd0cdc3e@huozhi.im>
JeromeFitz/next.js,JeromeFitz/next.js,JeromeFitz/next.js,JeromeFitz/next.js