P
P
Pavel2019-07-25 16:48:44
HTTP headers
Pavel, 2019-07-25 16:48:44

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");

and the problem seems to be gone.
It was in the saved cache.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
eRKa, 2017-11-12
@kttotto

As an option, the lodash library

A
Anthony, 2017-11-13
@cbolota

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 question

Ask a Question

731 491 924 answers to any question