URL that CFHTTP gives 403 but loads fine on browser

Been having problem on following code, the cfhttp gives a 403 message and yet the URL is loaded on browsers. Any idea why?

<cfhttp url="https://www.crowneplaza.com/hotels" method="head">	
</cfhttp>

Is it because you are sending a “HEAD” request?

Regards

Mark Drew

I still get 403 message even if I remove the method attribute.

Yeah, just checking this in PAW, (HTTP request and API tool) and HEAD and OPTIONS methods are not allowed by the server. The browser (if you go to that url) will use a GET request.

HTH

MD

If I do the following, I still get 403 message.

<cfhttp url="https://www.crowneplaza.com/hotels" method="get">	
</cfhttp>

Probably because it’s set to ignore requests that are not actually from browsers? 403 is “You might be allowed in, but I am still forbidding the request”

I notice in the browser it redirects and it’s being served from what looks like akamai (CDN network) so not sure what else it needs.

Did you try setting cfhttp-attribute resolveurl to true? I had a similar issue with redirecting urls once, and setting the resolveurl to true was a success.

Hi Andreas,

No luck on this one, still getting the 403 forbidden message.

ok. the web server does some header checks (this checks for accept-header request). If not set, it repsonds with a 403.

Try:

<CFHTTP URL="https://www.crowneplaza.com/hotels" METHOD="GET" timeout="5">
<cfhttpparam name="accept" type="header" value="*/*">
</CFHTTP>
<cfdump var="#cfhttp#">
1 Like