Proxies not working
ashwini-desai opened this issue · comments
Ashwini A. Mutalik Desai commented
Hello,
I am using this buildpack in a custom react-app(not created using create-react-app). I am able to see static assets and pages properly deployed. But proxy is not working. It gives 404.
I also set log level for error to info
to find out more, but nginx
isn't showing any error logs for the same.
Here is my static.json:
{
"root": "dist/",
"routes": {
"/**": "index.html"
},
"https_only": true,
"proxies": {
"/api/": {
"origin": "https://${API_APP_NAME}.herokuapp.com/"
}
},
"logging": {
"access": true,
"error": "info"
}
}
And here is nginx
log snippet:
2021-05-12T09:56:49.615126+00:00 app[web.1]: 2021/05/12 09:56:49 [info] 25#0: *15 ngx_mruby INFO ngx_mrb_run:885: mrb_run info: return value=(@/api/), client: 10.30.121.23, server: , request: "GET /api/hello HTTP/1.1", host: "learning-management-app-st.herokuapp.com", referrer: "https://learning-management-app-st.herokuapp.com/"
2021-05-12T09:56:49.643985+00:00 app[web.1]: 10.30.121.23 - - [12/May/2021:09:56:49 +0000] "GET /api/hello HTTP/1.1" 404 82 "https://learning-management-app-st.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"
Am I doing something wrong?
Ashwini A. Mutalik Desai commented
Hi, this issue got resolved. It had to do with the url defined in proxy settings. Had to pass /api/
in the origin too.
Closing this issue now.