CFHTTP doesn't resolve URL's properly on redirect
Posted by
Brad Wood
Jun 27, 2008 15:52:00 UTC
So I was working with CFHTTP the other day and noticed a strange behavior. There are two attributes I want to focus on: resolveurl and redirect. When setting redirect equal to true, ColdFusion will follow up to four 30x redirects (if a location header is provided) the most common being 302 (moved temporarily) and 301 (moved permanently).
Redirects actually happen more often than you probably think. Did you know every time you type in a URL like "www.server.com/folder" your browser has to make two requests to get the page. There might be a file called "folder", but if there isn't, a 302 comes back and says check out "www.server.com/folder/" (with the trailing slash).
A very common example of the 301 redirect is when you type in "yahoo.com". The server comes back and says try "www.yahoo.com".
Tags: ColdFusion