URL that CFHTTP gives 403 but loads fine on browser


#1

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>

#2

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

Regards

Mark Drew


#3

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


#4

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


#5

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

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

#6

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.


#7

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.


#8

Hi Andreas,

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


#9

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#">