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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -