Cfhttp is getting Re-redirected

Posted on 2009-04-20
Last Modified: 2013-12-24
I am trying to use CFhttp and redirect to a page, but it puts me back to the login area of my wordpress blog.

I get different responses when I try to go two different urls.

URL 1: the admin area of wordpress
URL 2: the login area of wordpress

When I try to use CFhttp to go the admin area... it just shows (redirects to) the login. I want it to cfhttp to the admin area! I am already logged in, so that is not the issue. I also don't think that this is a wordpress issue per se, but it's what I'm working with.

Below are the two different header responses from the two pages:
URL 1: (This does not go where I want it to - it re-redirects to the login page)

HTTP/1.1 200 OK Connection: close Expires: Wed, 11 Jan 1984 05:00:00 GMT Date: Tue, 21 Apr 2009 01:11:49 GMT Server: Apache/2.2.3 (CentOS) Content-Length: 2166 X-Powered-By: PHP/5.1.6 Pragma: no-cache Cache-Control: no-cache, must-revalidate, max-age=0 Set-Cookie: wordpress_test_cookie=WP+Cookie+check; path=/; Last-Modified: Tue, 21 Apr 2009 01:11:50 GMT Content-Type: text/html; charset=UTF-8 

URL 2: (The login area)

HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Connection: close Date: Tue, 21 Apr 2009 01:12:37 GMT X-Pingback: Server: Apache/2.2.3 (CentOS) X-Powered-By: PHP/5.1.6

Open in new window

Question by:monosyth
    LVL 27

    Accepted Solution

    CF server is not you. just because you are logged in to your blog in your browser does not mean CF is logged into there.

    i do not use WP, so i do not know what kind of authentication they use or if they provide any API for accessing admin area remotely... but supposedly WP login is a simple form you have to fill in and submit? if so, you may want to try passing your login credentials in <cfhttpparam> tags with cfhttp POST request...

    if WP uses cookies to authenticate users and keep them logged in, then it will be a bit trickier as you will need to get that cookie and pass it in your every other cfhttp request...

    google cfhttp cookie for some examples how this can be done.
    or check these Ben Nadel's blog entries (they come up as #1 and 2 results in google search any way):


    Author Comment

    This is definitely a cookie and cfhttp problem.

    I need to figure out how to get the cookie information and pass it through. When i try it now, it returns this info:

    Cookie Name= wordpress_test_cookie
    Cookie Value= WP+Cookie+check

    These are not real cookie names and values...
    LVL 27

    Expert Comment

    that first link i posted explains in great detail how to extract returned cookie info and use it in subsequent cfhttp requests.


    Author Comment

    It's a bit in depth for me at my expertise level, so it will probably take me a while to figure it out.
    LVL 27

    Expert Comment

    Ben's explanation just looks overwhelming - once you start working through the code it is actually pretty straight-forward.
    his code samples are always top-notch, and you will probably pick up a few good code habits from there (i know i did!).

    just shout if you get stuck or need any help!


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now