I am using axios in my react app to make calls to a api server. My api server is receiving double network calls for each request (one from my react app user agent and one from axios).
Nginx logs:
52.01.179.169 - - [09/Jan/2017:02:17:13 +0000] "GET /my_endpoint HTTP/1.1" 200 756 "-" "axios/0.9.1" "-"
72.201.237.55 - - [09/Jan/2017:02:17:13 +0000] "GET /my_endpoint HTTP/1.1" 200 756 "http://localhost:8080" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36" "-"
Why is this happening? The second request is what I really care about, but my api server is unnecessarily doing double the work.
My web console indicates that only one AJAX call is being made, so where is this rogue axios request coming from?
Code:
export function myEndpoint() {
var url = API_BASE_URL + '/my_endpoint'
console.log(url);
const request = axios.get(url);
return {
type: 'my_endpoint',
payload: request
};
}
FWIW, the console only logs this url once.