MPaul
MPaul

Reputation: 2733

Retrieving HTTP header values

How can one retrieve an HTTP header value such as REFERER as opposed to using the CGI scope?

For example, CGI can be used as such:

#CGI.HTTP_REFERER#

However, can a header value be retrieved in the same manner without having to use the <cfhttpparam> parameter?

#HTTP_HEADER.REFERER#

Upvotes: 3

Views: 758

Answers (1)

MPaul
MPaul

Reputation: 2733

Found the solution:

<cfdump var="#GetHttpRequestData()#" label="GetHttpResponseData() Values"/>

Source: https://www.bennadel.com/blog/1425-getting-header-values-from-a-coldfusion-request.htm

Update

To expand on this a little more, the exact line of code would be:

#getPageContext().getRequest().getHeader("Referer")#

Upvotes: 3

Related Questions