webpack dev server - Proxy is appending target, not replacing it -
so i'm using webpack dev server comes packaged create-react-app, , use bunch of fetch requests post data backend on server, when i'm working on localhost, i'm trying redirect requests simple file returns "true" fetch request:
fetch('/validate/validate/from-zipcode', { method: 'post', credentials:'include', headers: new headers({ 'accept': 'application/json, text/javascript, */*', 'content-type': 'application/x-www-form-urlencoded; charset=utf-8', 'x-requested-with': 'xmlhttprequest' }), body:'zip_from='+this.props.fromzip }).then((res)=>{ return res.text(); }).then((res)=>{ if(res==="true") this.props.choosefromzip(this.props.fromzip,this.fromcity,this.fromstate); else this.setstate({error:'block'}) });
proxy code:
"proxy":{ "/validate/validate/*":{ "target":"http://localhost:3000/validate/test.html", "ws":true } }
this what's happening...
proxy error: not proxy request /validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html /validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html /validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html /validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html/validate/test.html ... /validate/test.html/validate/validate/from-zipcode localhost:3000 http://localhost:3000/validate/test.html (econnreset).
any suggestions, or idea i'm doing wrong?
Comments
Post a Comment