Skip to main content
Known Participant
June 12, 2011
Question

Weird behavior on CGI.REQUEST_METHOD for CFFORM

  • June 12, 2011
  • 4 replies
  • 2551 views

I have run across a strange behavior and want some other folks' thoughts. I have a simple cfform where I am self-submitting with a post method. The form is nothing unusual. Some validation, but nothing out of the ordinary. The form was not functioning properly and when I dumped the form scope to the page, it was empty. I began to dig deeper and decided to dump the cgi scope. That is when I noticed that the request_method was showing GET not POST. Has anyone run across this before? Why would it not be post as in my cffom method? I am wondering if it might be a CF server setting because when I created it with html form tags, it worked. Thoughts?

~Clay

    This topic has been closed for replies.

    4 replies

    fs22Author
    Known Participant
    June 13, 2011

    ok...have it figured out. In the environment our IT team setup, we have two CF servers for load balancing purposes. However, the CF servers are not doing the load balancing. That is being handled via proxy. So what was happening was this...Someone would hit the app, we checked whether they were logged in via a session variable. If they were not logged in, then we would take them to the log in screen. So sometimes it worked, sometimes it did not. When it did not, this is what would happen...the end user would hit the app, not logged in and be redirected to the login screen. The end user would log in and be taken back to where they left. Due to the proxy doing the load balancing, they would be taken back to a different server. The app would run the aforementioned log in check, but since the end user was on a different server, the session variable would not exist and they would be redirected back to the login page. So the IT staff and I did a few different things. IT set the proxy to have 'sticky' sessions. I setdomaincookies to yes in cfapplication. I then changed from checking a session variable to a client variable.

    If anyone has any thoughts that might improve the scenario, let me know. I appreciate the feedback thus far.

    ~Clay

    BKBK
    Community Expert
    Community Expert
    June 12, 2011

    fs22 wrote:

    ... when I dumped the form scope to the page, it was empty.

    And when you dump the URL scope? That should tell us something.

    BKBK
    Community Expert
    Community Expert
    June 12, 2011

    fs22 wrote:

    I have run across a strange behavior and want some other folks' thoughts. I have a simple cfform where I am self-submitting with a post method. The form is nothing unusual. Some validation, but nothing out of the ordinary. The form was not functioning properly and when I dumped the form scope to the page, it was empty. I began to dig deeper and decided to dump the cgi scope. That is when I noticed that the request_method was showing GET not POST. Has anyone run across this before? Why would it not be post as in my cffom method? I am wondering if it might be a CF server setting because when I created it with html form tags, it worked. Thoughts?

    That is as it should be. Forms do not create CGI variables. CGI variables are read-only environment constants determined by the server and the browser.

    To verify this, run a page containing just this code: <cfdump var="#cgi#">. There is no form, yet you will see that cgi.request_method is GET.

    Inspiring
    June 12, 2011

    Forms don't, but when the web server receives a POST request (like from a form submission where the method is set to POST), it sets CGI.REQUEST_METHOD to POST, like the OP said.

    We need to see the repro case.

    --

    Adam

    fs22Author
    Known Participant
    June 12, 2011

    Here is the form code...pretty straight forward...nothing flashy...

    <cfform action="https://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#" method="post" name="security">
               Sign In Name<cfinput type="Text" name="username" required="yes" id="username">
                Password<cfinput type="password" name="password" required="yes" id="password">
               <cfinput type="Submit" name="verify" value="Log In" id="verify">
    </cfform>
    talofer99
    Inspiring
    June 12, 2011

    If u add method ="post" to your cfform tag, does it solves the problem ?

    OR does it still post the for as GET ?

    fs22Author
    Known Participant
    June 12, 2011

    I explicitly state the method. So my cfform tag already has the method attribute set to post.

    talofer99
    Inspiring
    June 12, 2011

    all I can suggest is that u post the cfform code (and what ever is beofre and after) .. maybe then soemone can spot somthing out ...

    But its only a suggestion