Answer the question
In order to leave comments, you need to log in
Why is HTTP_REFERER not being passed from PS?
There is a script that checks HTTP_REFERER, and if the user has moved from search engines, it will redirect it. Otherwise, it shows a specific stub.
But the script does not work correctly, when switching from the PS it shows a stub, with a direct entry it can redirect. From the logs, I realized that the referrer was not transmitted when switching from Yandex.
But why?
And, what is most interesting, if you open the developer console in chrome - everything works as it should! wtf?
I suspect that some server settings. But where to dig?
UPD: I noticed that everything works with the open console and the "disable cache" checkbox.
added to code
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
Answer the question
In order to leave comments, you need to log in
const arr = [{name: "one", q: 5},{name: "one", q: 3},{name: "two", q: 1},{name: "two", q: 6},{name: "three", q: 10}]
const result = arr.reduce((acc, obj) => {
let index = acc.findIndex((elm) => {return elm.name == obj.name});
if(index == -1){ return acc.concat(Object.assign({}, obj) };
acc[index]['q'] += obj.q;
return acc
}, [])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question