I used to have the same problem in my former projects. I remember the best solution that we found finally is to use a tranfer page between page A and page B. Then you can easily get the source of the request if it's from A or B and give response respectively.
This post has been archived. It cannot be replied.