1

We are using this code in the application file -

<cfparam name="session.outbound_referer" default="">
<cfif cgi.http_referer does not contain cgi.http_host>
    <cfset session.outbound_referer=cgi.http_referer>
</cfif>

Hello - we are currently getting the domain of the referrer. This is working. We need help getting the full path of the referring url. 

For example...

Lets say someone comes from google using this search

https://www.google.com/search?q=tax+preparation+08816&rlz=1C1CHBF_enUS859US859&oq=tax+pre&aqs=chrome.1.69i57j35i39j69i65l3j69i60l3.3697j0j7&sourceid=chrome&ie=UTF-8

We are already getting:

https://www.google.com/

but how do we go about getting the rest of that string?

search?q=tax+preparation+08816&rlz=1C1CHBF_enUS859US859&oq=tax+pre&aqs=chrome.1.69i57j35i39j69i65l3j69i60l3.3697j0j7&sourceid=chrome&ie=UTF-8

or just

search?q=tax+preparation+08816

Next example:

https://antonuccilegal.com/blog/new-jersey-auto-insurance-consumers-have-rights/

If this was referrer url, we would get...

https://antonuccilegal.com/

but we want full path

https://antonuccilegal.com/blog/new-jersey-auto-insurance-consumers-have-rights/

We are running Coldfusion 2016 and need some guidance.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • This is the code being used in referrer ``` – Dominic Parrillo Jun 23 '21 at 18:50
  • For what it's worth, I'm on CF 2018 and `CGI.HTTP_REFERER` does contain the query parameters. Is it just a difference between versions? have you dumped the whole CGI scope? – TRose Jun 23 '21 at 19:15
  • 1
    Does this answer your question? [How reliable is HTTP\_REFERER?](https://stackoverflow.com/questions/6023941/how-reliable-is-http-referer) – Adrian J. Moreno Jun 23 '21 at 22:34
  • If you dump out the entire header stack, does the `http_referer` contain just the domain or a URL to some specific page on the domain? Are you trying to determine if the current request originated on the same site? If not, what are you trying to do? – Adrian J. Moreno Jun 23 '21 at 22:39
  • 1
    The referrer is out of your control and is frequently overwritten by bots, so do not rely on this at all. If you need to track requests across (your) domains, consider [UTM](https://en.wikipedia.org/wiki/UTM_parameters) instead. – Alex Jun 26 '21 at 12:10

0 Answers0