Something I used to do (switching the apiProxyPath in redwood.toml) is no longer working. I’m not sure when it broke, but it worked a week or two ago.
My use case is that I want to be able to run my local web client, but connect to a remote API server. This is either because I’m testing or because there’s better data in a staging environment. The code change below used to work.
[web]
port = 8910
#apiProxyPath = "/.netlify/functions"
apiProxyPath = "https://foo-bar-staging.herokuapp.com"
[api]
port = 8911
[browser]
open = false
Now when I do this, any URL I request other than the root (i.e. localhost:9810/users) bypasses the web tier, goes straight to the API tier (localhost:8911) and resolves as a 404, since there is no /users function defined on the backend.
It definitely used to be possible, because I ran a local instance of the Redwood Blog Example App against a remote API server powered by Nexus as a proof of concept for using Nexus with Redwood. Worked quite nicely at one point.
I’ve been digging around the redwood source code trying to sort out this issue and I tried something weird. I set apiProxyPath to something really silly:
apiProxyPath = "/foo/bar/"
I then restarted my server and, to my shock, everything worked fine! Which is definitely confusing, but possible a hint at what’s going on?
I hope this helps, I’m currently totally blocked by this. I’ll keep digging!
Sorry, I didn’t mean to imply my problem was gone or that the issue was fixed. I meant that I was surprised that I could set apiProxyPath to a nonsense value like "/foo/bar" and have Redwood successfully proxy API requests to localhost:8911.
However, I still can’t set apiProxyPath to a fully qualified URL. It seems like this was once possible in RedwoodJS 0.4.0 and it’s something that Create React App provides out of the box.