Proxy Rewrite Netlify function from one domain to other

I am trying to figure out how to proxy rewrite netlify functions from a domain to an other.

Lets say i have a public domain called https://example.com
At that domain theres som subpaths like /site1, /site2, /site3 (https://example.com/site1) that all have their own sites / applications.
The current rewrite settings on the top domain is:
[[redirects]]
from = “/site1/*”
to = “https://site1.example.com/:splat
status = 200
force = true

Everything works as expected and the “shadow” domain can be accessed from the top domain.
But when i request a netlify function from the top domain i m not getting any result.
I get a 200 respons but the body is empty.

The example would be:
https://example.com/site1 → Works
https://example.com/site1/.netlify/functions/hello → Does not work
https://site1.example.com/.netlify/functions/hello → Works

The reason i have this setup is to have a top domain and run multiple sub applications/languages beneath it, and i dont know why the rewrite proxy for the netlify functions doesnt work.

Hey there, @raketwebbyra :wave:

Welcome to the Netlify Forums :netliconfetti: Thanks so much for reaching out.

It looks like this thread has been a bit quiet since you posted. Are you still encountering this issue? If you are, please share the following:

  1. Your Netlify site names (both working and non-working)
  2. Any additional debugging steps you have taken since posting

Hey!

I have setup a live example.
This is the main site: https://main.raket.nu/
This is the subsite: https://test.main.raket.nu/

On the main site there is a redirect config like this in the netlify.toml:
[[redirects]]
from = “/test/*”
to = “https://test.main.raket.nu/:splat
status = 200
force = true

And the url: https://main.raket.nu/test works fine
As well as:
https://test.main.raket.nu/api/hello &
https://test.main.raket.nu/.netlify/functions/hello

But not the proxy rewrite to the netlify function:
https://main.raket.nu/test/.netlify/functions/hello or
https://main.raket.nu/test/api/hello

Hey @raketwebbyra,
Looks like you may be running into the same issue as over here → Proxying from one app to another - #8 by luke Would you mind trying Luke’s workaround and letting us know how it goes? If that turns out to be the problem, I’ll add this thread to our internal tracking issue for the bug.