Blog

ColdFusion 2021 CFHTTP returning 404

December 31, 2020

In ColdFusion 2021 I encountered a new wrinkle when using CFHTTP. The url attribute must contain no leading or trailing spaces:

<cfhttp url="#trim(someurlvariable)#">

In my case the value of someurlvariable was coming from a database.

2 Comments

James Moberg
James MobergApril 16, 2021 at 12:34:13 am

Weird. IsValid("url") and isValid("email") allow leading or trailing carriage returns, new lines, tabs or spaces. (They shouldn't. Most regex rules don't trim strings before testing them.) I tested using TryCF.com and invalid spaces appear to be used with CFHTTP using 2021,0,0,323925.

Jason Holden
Jason HoldenMay 13, 2021 at 2:26:10 pm

@James I noticed that TryCF.com appears to be running on a Linux platform. This problem occurred in a Windows environment. Perhaps it's an issue with the JVM or even the OS.

Leave Your Comment

Your email address will not be published. Required fields are marked *


about me

An information technology professional with twenty two year's experience in systems administration, computer programming, requirements gathering, customer service, and technical support.