There are upcoming maintenance events which may impact our services. Learn more

Detecting HTTPS using x-https Print

  • Lucee, HTTPS, SSL
  • 2

You can use x headers to detect if the URL is using HTTP or HTTPS, you will find the header x-https only exists in the GetHttpRequestData() method when using HTTPS. Below is a simple IF statement to detect this:

<cfif StructKeyExists(GetHttpRequestData().headers, 'x-https')>
HTTPS
<cfelse>
HTTP
</cfif>

Seeing all x headers:

You can use the following code to dump call request headers that tomcat proxy will detect:

<cfdump(GetHttpRequestData())>


Was this answer helpful?

« Back