mars / create-react-app-buildpack

⚛️ Heroku Buildpack for create-react-app: static hosting for React.js web apps
MIT License
3.28k stars 653 forks source link

Static.json file doesn't proxy requests #177

Closed conacelelena closed 4 years ago

conacelelena commented 4 years ago

Hello,

I am using this buildpack to deploy my create-react-app to heroku. The deployment works alright, but the api calls to a server hosted separately don't. I followed the guidelines and created a static.json file with the following content: { "root": "build/", "routes": { "/**": "index.html" }, "proxies": { "/v1": { "origin": "xxx" } } }

In my redux store I have actions that call '/v1/x/' and they don't use the origin set in static.json (they use the root link). Don't know what I am missing and I would appreciate your help.

(For my development I'm using the http-proxy-middleware gem, since I cannot set up the proxy just for the /v1 routes in the package.json).

Thank you, Cristina

conacelelena commented 4 years ago

Hello,

The calls were actually getting to the server but without the /v1 (which was replaced) and that is why I was getting the 404s. I included /v1 at the end of the origin for the api calls and it works now. I am closing this issue.

Thanks, Cristina