We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49659
    • 86 Posts
    Hi,

    I'm trying to get a basic 'Contact Us' form up and running using SPForm, and am getting a 'Disallowed HTTP Referer' error when opening the form.

    However, as far as I can see, the 'formProcAllowedReferers' parameter is set correctly. Using the &spfDebug=`1` parameter, I get these values related to HTTP referer:
    referer: http://socotango.org/myhomepage.php
    formProcAllowedReferers: www.socotango.org,socotango.org


    Still, the form opens with this error prompt:

    Error: Disallowed HTTP Referer! "http://socotango.org/myhomepage.php"

    By the way, I did clear the cache.

    Any ideas how to troubleshoot this?

    Thanks,

    Karl Forsyth

    This question has been answered by kjforsyth. See the first response.

      • 49659
      • 86 Posts
      Update: the form just started opening correctly and automagically. Problem not solved, but at least gone!
        • 49659
        • 86 Posts
        Second update: It's baaack! It just started back with the 'Disallowed HTTP Referer' error when opening the form.

        Any ideas here? Maybe I need an exorcist. ;-)
          • 3749
          • 24,544 Posts
          I wrote that code in 2008! The code is somewhat embarrassing and painful to look at.

          Are you by any chance typing or pasting the URL of the form when testing? Unless you get to the page via a link, there's no referer.


          You should be able to bypass the error by putting this in the snippet tag:

          &chkFormRefNotBlank=`0` 
          &chkFormRefNotSelf= `0` 
          &chkFormRefOwnServer=`0`


          Most spammers know enough to spoof the referer anyway.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 49659
            • 86 Posts
            Hi Bob,

            Wow, that's pretty old in web years. ;-)

            I'll try those suggestions.

            I'm trying SPForm out of exasperation with the Formit 'Contact Us' form which I installed early on in this project. It was working fine until it stopped working at some point (don't know exactly when), without any errors going to the MODX log. To troubleshoot the Formit issue, I tried removing the 'redirect' hook, which revealed this error in the '[[!+fi.validation_error_message]]' placeholder at the top of the form:

            "A form validation error occurred. Please check the values you have entered."

            The 'Contact Us' form values are in fact correct, and that validation error shouldn't be happening. I've even removed all "[[!FormIt? &validate..." parameters, and "[[!field? &req=`1`..." parameters.

            Any ideas why the Formit validation is failing regardless of the fact that all validation is turned off, and even if it wasn't turned off, the form values are valid?

            Karl
              • 3749
              • 24,544 Posts
              Did you manually delete the core/cache files after making the changes?
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 49659
                • 86 Posts
                Yes I did. No effect.
                  • 3749
                  • 24,544 Posts
                  You're still getting the "Disallowed HTTP Referer" error?

                  That's really strange. That error is only generated in one part of the snippet and setting those properties should bypass it completely. I'm not sure what to suggest.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                  • discuss.answer
                    • 49659
                    • 86 Posts
                    Hi Bob,

                    Per your suggestion, I added these parameters, and by experimenting found that these settings work:
                    [[!SPForm? 
                        &chkFormRefNotBlank=`1` 
                        &chkFormRefNotSelf= `0` 
                        &chkFormRefOwnServer=`1`
                        &spfDebug=`0`
                    ]]


                    It fails reliably with the "Disallowed HTTP Referer" error when the '&chkFormRefNotSelf' parameter is set to 1.

                    Thanks!

                    Karl Forsyth

                      • 3749
                      • 24,544 Posts
                      I'm glad you got it sorted. smiley
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting