• Resolved mikehermary

    (@mikehermary)


    Hello,

    I have created and published a post data form on my client’s website. The form has been added to a page using a Gutenberg block.

    The form loads correctly for logged in users, but is interrupted for non-logged in users. A browser username and password prompt is displayed first, but when cancelled the form appears. There is no Apache-based password protection set for this URL.

    The following errors are displayed in the browser console: GET https://www.flagstaff.ab.ca/wp-admin/js/media-upload.min.js?ver=6.2 net::ERR_ABORTED 401, GET https://www.flagstaff.ab.ca/wp-admin/js/editor.min.js?ver=6.2 net::ERR_ABORTED 401, Uncaught TypeError: Cannot read properties of undefined (reading 'editor') at (index):638:33.

    The wp-admin directory has the following in its .htaccess file:

    <Files "admin-ajax.php">
        Allow from all
        Satisfy Any
    </Files>

    Behavior Method: AJAX
    Validation: Onsubmit
    Rendering: Load form using AJAX
    I have toggled on and off these setting with no success.

    Security: Enable logged in submission only is disabled

    Caching has been disabled with no success.

    Any ideas on how to fix this?

    Cheers,

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mikehermary

    (@mikehermary)

    Hello,

    Update: it looks like Apache2-based password protection on the wp-admin directory is the culprit.

    I have temporarily removed it and the form is loading on the front-end with no issues. I have included the code from virtual host file for reference below.

    <Location /wp-admin>
        AuthType Basic
        AuthName "Restricted Content"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Location>

    This surely is a bug as I need to keep the wp-admin directory protected.

    Cheers,

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @mikehermary,

    From what you have stated it’s more specific to how you have added the restrictions via .htaccess file.

    The plugin relies on /wp-admin/admin-ajax.php calls when you have a Load form using AJAX enabled and hence you are noticing the Auth password prompt.

    This would be the same for any other plugins which use admin-ajax calls, you’ll have to make sure you have allowed admin-ajax.php access in your .htaccess file to prevent such issues from occurring.

    For example:

    <files admin-ajax.php>
    Order allow,deny
    Allow from all
    Satisfy any
    </files>
    

    I tested in my system with the above setup and I’m not able to replicate any such issues with how the forms are loaded when logged out.

    Please do check and advise if I’m missing out on anything and if you have any further queries.

    Kind Regards,

    Nithin

    Thread Starter mikehermary

    (@mikehermary)

    Hello,

    Thanks for the reply and information. I had already added that code to the .htaccess file within the wp-admin directory. It did not solve the issue with loading the editor on the front-end without errors.

    I was able to resolve the issue by creating a .htaccess file within the wp-admin > js directory and placing the following code within the file.

    <Files "editor.min.js">
        Order allow,deny
        Allow from all
        Satisfy any
    </Files>

    This code removed the 401 errors and eliminated the browser login prompt. This is probably not the correct way to resolve this issue, but I needed to launch this functionality on my client’s website, so I went this route.

    Please advise if there is a better way to resolve this issue.

    Cheers,

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mikehermary

    If you got entire /wp-admin/ folder password-protected using HTTP auth then yes – it would be a solution.

    I understand the need for protection but if you need to use it – then you also need to add “exceptions” for all the files needed by plugins/theme. Currently it may only be Forminator but in future it may also be some other plugin and you may also need to add other exceptions this same way.

    Kind regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mikehermary ,

    We haven’t heard from you for some time now, so it looks like you don’t have more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Front-end form loading issues’ is closed to new replies.