The expected behaviour is that when you proxy, the Function receives the original request URL, not the proxied one. I had raised this before as well, but forgot about that thread. Then I remembered and noticed this is an exact same case.
The situation is:
- Request to
/
- Gets proxied to
/tt
/tt
is handled by Next.js Server Handler Function- The expected behaviour is to pass
/
(original URL) to the Function as opposed to the new URL (/tt
) - Thus, Next.js server sees the URL as
/
instead of/tt
and sends the data for/
.
You can reproduce this with any setup, such as a simpler reproduction that I created for this: github.com/hrishikesh-k/f-126343 which does not involve Next.js, but simply uses Functions natively. The 2 domains attached to the site are: https://f-126343-1.tejalshinde.com/ and https://f-126343-2.tejalshinde.com/.
Making a request to https://f-126343-2.tejalshinde.com/
will show home
instead of page-1
.