Skip to main content
Known Participant
September 23, 2009
Question

Using CFHTTP on same domain

  • September 23, 2009
  • 4 replies
  • 1885 views

Hi all,

I'm having an issue that I've pinned down to the fact that I'm using a CFHTTP to access a file on the same domain as the script calling it.  This is old code that I inherited and don't have the time, resources, permissions, etc, to change up.  I'm basically getting a connection timeout.

   I'm using CFMX7.

   I'm not sure what other information you would need, so just ask if you need to know something else.

   Is there a way to make this work?

   Thanks.

    This topic has been closed for replies.

    4 replies

    revdovieAuthor
    Known Participant
    September 24, 2009

    and, oh yea...I also put the file on another server/domain of ours and accessed it that way and it works fine.  It only fails when the domain is the same as the file with the cfhttp.

    and, no, I can't just store the files on the other server.

    ilssac
    Inspiring
    September 24, 2009

    Is the server/domain you are dealing with a public web server or a private web server for a local intranet?

    If the latter are their any security on the web server, such as windows integrated security?

    ColdFusion, not being a Microsoft product, does not work well with windows integrated security.

    This often shows up when people try to develop scheduled tasks or use the <cfhttp...> tag.

    revdovieAuthor
    Known Participant
    September 24, 2009

    It's a public web address, accessible to all.

    revdovieAuthor
    Known Participant
    September 24, 2009

    As far as the code, I can't really due to proprietary reasons, but it seriously is just a CFHTTP that works if I call anything but the domain the calling file is on.  For example, if my domain was http://www.revdovie.com and I tried to CFHTTP something else on www.revdovie.com, it times out.  In the very same line, if I change it to www.yahoo.com or something else, it goes fine.

    I've tried the IP trick, and it didn't work, but actually you gave me an idea to try something else.  I'll try that and see if it works.

    Thanks.

    Inspiring
    September 24, 2009

    As far as the code, I can't really due to proprietary reasons, but it seriously is just a CFHTTP that works if I call anything but the domain the calling file is on.  For example, if my domain was http://www.revdovie.com and I tried to CFHTTP something else on www.revdovie.com, it times out.  In the very same line, if I change it to www.yahoo.com or something else, it goes fine.

    I've tried the IP trick, and it didn't work, but actually you gave me an idea to try something else.  I'll try that and see if it works.

    Hmmm.  So you've not tried to factor down the code to try to isolate what the issue is?  I would have thought that had you done something like this, then that "test" code wouldn't break any NDA type stuff.  Well, really, a couple of files or extracts of code isn't going to violate anything like that either, but... Oh well.

    There's nothing intrinsically wrong with <cfhttp> calls to the same domain the request is being made from, anyhow.

    Is there a chance that your <cfhttp> call is being made from a URL which, as part of the rest of the request, is ending up calling itself again?  Like, for instance, calling it from your Application.cfm?

    --

    Adam

    revdovieAuthor
    Known Participant
    September 24, 2009

    I actually have done all that.  the actual line of code is:

      <cfhttp url="#myUrl#" throwOnError = "yes" timeout="10"></cfhttp>

    where #myUrl# resolves to a url on my company's site (I'm not sure they want me putting their site name here is my issue).

    The page this is all in, is on the same domain.  When I type in the full url in a browser, it's fine and dandy.  When I type it out in the cfhttp, it times out.  If I sub out something like http://www.yahoo.com everything moves along fine.

    I've heard of this happening before, but never found a solution to it.  One place seemed to think that maybe changing the userAgent would help.  It didn't.  Another place said something about checking with the sysadmins to see if the way the server handles incoming cfhttp calls is different.  Another place said that apparently cfhttp does in fact handle calls to its own domain differently and that may be causing the issue.

    I've also tried subbing the actual IP for the domain, and that doesn't work either.

    Inspiring
    September 23, 2009

    I've got servers, where because of configuration, I have to use the internal IP address for CFHTTP from the server, to itself.

    For example:

    <CFHTTP URL="http://192.168.168.xxx/file.cfm"...

    Inspiring
    September 23, 2009

    Probably seeing the code involved might help.

    --

    Adam