Site A (frontend): competent-ardinghelli-0dde0e
Site B (data and function): stoic-galileo-1d5a50
I have the following redirect in the netlify.toml for Site A:
[[redirects]]
from = "/api/search"
to = "https://stoic-galileo-1d5a50.netlify.app/.netlify/functions/search"
status = 200
force = true
The function takes a single query parameter term, and I’m hoping to call https://competent-ardinghelli-0dde0e.netlify.app/api/search?term=searchterm.
While the redirect appears to work, the request fails in browser (Firefox provides an actual error, while others never return or return empty responses):
Hey @andrewbridge,
When I try to curl https://stoic-galileo-1d5a50.netlify.app/.netlify/functions/search directly, I get a 401. So can you confirm that it returns what you would expect? That way we can at least narrow the issue to being about proxying.
{"posts":[{"route":"/reviews/michael-jackson-bad","title":"Bad // Michael Jackson"},{"route":"/reviews/bat-for-lashes-lost-girls","title":"Lost Girls // Bat for Lashes"},{"route":"/reviews/prince-purple-rain","title":"Purple Rain // Prince"},{"route":"/reviews/kate-bush-hounds-of-love","title":"Hounds of Love // Kate Bush"}],"tags":[{"title":"michael jackson","route":"/tags/michael jackson"}]}
(Actual results may vary, but the structure is accurate)
Let me know if there’s any further information I can provide.
Dang, I’ve hit this bug before It hasn’t been fixed yet but @luke proposed a solution to a similar problem over here → Proxying from one app to another - #8 by luke Want to give that a try and let us know if it fixes things for you?