Forum Moderators: open

Message Too Old, No Replies

HTTP REFERER Woes

         

inveni0

6:56 pm on Oct 12, 2006 (gmt 0)

10+ Year Member



I have a form on a webpage that, when submitted, reloads the page with a redirect in the MetaTag. However, once the form is submitted, and my other website gets the hit, the referrer shows the ORIGINAL referrer, and not that the hit actually came as a result of a form submission on my website.

Is there any reason this is happening this way? Is there a work around? A way to spoof the HTTP_REFERER in the SERVER vairables?

kaled

8:21 pm on Oct 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I understand you correctly (not sure) you could try a javascript redirect instead.

If you place the javascript redirect above a meta redirect it should still work (with the wrong referrer) if javascript is disabled.

NOTE
Referrer data is entirely under the control of the browser (and can be switched off) different browsers may behave differently. You should probably look for an alternative approach.

Kaled.

inveni0

8:39 pm on Oct 12, 2006 (gmt 0)

10+ Year Member



What happens is this:

1-The user enters my site with a certain referral code (?SRC=X)
2-PHP Code checks this referral code. If it is present, it checks to see if the traffic is coming from a specific referral site.
3-If both of these conditions are true, PHP writes a form to the document that autoposts, sending a random URL from a database back to the header.
4-Another PHP script writes a meta tag that redirects the browser to the database URL.

So: The user comes from X website by clicking on X link. A PHP script checks this. If true, it autosubmits a form that refreshes the page with a TRUE value. A second PHP script checks the TRUE value from the form and then writes a line to redirect the browser.

And this doesn't show my site as being the referer! Maybe having the form autosubmit to another page on my site will change the referer?

kaled

12:08 am on Oct 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Without knowing in detail what you're trying to achieve and why, I cannot be certain, but my instinct is that this is an overly complicated solution (and possibly a slowish one) to a problem.

Might I suggest that you go back to the beginning and look at the whole problem rather than this small part - you may find a simpler and more efficient solution.

In any case, you should ensure that your website does not fail if referrer data is switched off in the browser.

Kaled.

jdMorgan

12:40 am on Oct 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just a technical note: A meta-refresh is not an HTTP redirect. It is a client-side reload. Therefore, the Referer header (an HTTP header that may be sent with each request to the server) is not updated to reflect the URL of the page invoking the meta-refresh.

I agree with Kaled that there are better ways to achieve your goal, but hopefully, this explanation of why you're having trouble will help.

Jim

stajer

12:54 am on Oct 13, 2006 (gmt 0)

10+ Year Member



I would also suspect the auto posting form. It may post before the page is fully loaded in your browser.

inveni0

1:24 am on Oct 13, 2006 (gmt 0)

10+ Year Member



Just a technical note: A meta-refresh is not an HTTP redirect. It is a client-side reload. Therefore, the Referer header (an HTTP header that may be sent with each request to the server) is not updated to reflect the URL of the page invoking the meta-refresh.

That's the information I was looking for. I will try auto-posting to another page and moving my form to the bottom of the page.

Thanks!