0

I'm trying to use the proxy field in package.json to proxy my fetch calls to aws api gateway endpoint. I've tried million of ways and still it's not working. my setup is:

"proxy": {
"/DEV/*": {
  "target": "https://xxx.execute-api.eu-west-1.amazonaws.com",
  "secure": false
}

}

I also tried other 1000 combinations (secure to true , changeOrigin or /DEV) and also:

 "proxy":  "https://xxx.execute-api.eu-west-1.amazonaws.com",

even I tried restart my pc :) my call is:

return fetch('/DEV/servers', {
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'session': getState().authReducer.auth.session
        }

unfortunately no success, still it tries to call http://localhost:9000/DEV/servers wonder if I needed to do something else first which I haven't done. Thanks

2
  • the call to localhost is correct. that's what the proxy is for. or do you mean that your webpack dev server is trying to call itself Commented Apr 9, 2018 at 15:16
  • if you want to make a call directly to your aws url then instead of a proxy you want to use an environment variable Commented Apr 9, 2018 at 15:16

1 Answer 1

1

Ok so after one day I found out :((

it was the corporate proxy of our company... basically I had proxy on my browser but not on webpack so at some point I tested localhost and I saw that it's working. then I tried with internet without any proxy (vpn) and it worked

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.