I can't get Safari to submit forms to a page that is protected by .htaccess.
I have reduced my test page to:
<html>
<body>
<?php
if(isset($_REQUEST["name"]))
echo "<p>You entered: ", $_REQUEST["name"], "</p>";
?>
<form method='post' action='index.php'>
<p><input type='text' NAME='name'>
<input type='submit' name='send' value='Send'></p>
</form>
</body>
</html>
If I remove the .htaccess file the above page runs without any problem.
With this .htaccess file Safari will never finish loading the page:
AuthUserFile /xxxx/xxxx/.htpasswd
AuthGroupFile /xxxx/xxxx/.htgroup
AuthName Members
AuthType Basic
<Limit GET POST>
require group XXXXX
</Limit>
ErrorDocument 401 /errors/401.php
Is there a workaround for this problem?
Update
I can remove the POST limitation in the .htaccess file:
<Limit GET>
require group XXXXX
</Limit>
This will work for the above test case, but I won't be logged in anymore which means that:
- I don't have access to
$_SERVER["PHP_AUTH_USER"]
- I have a security hole
Any ideas?
Update 2
I have added a missing line in the .htaccess file above (ErrorDocument 401 /errors/401.php
) and made a personal reminder to always include everything in the samples (I'm supposed to know this). Helped by the comments from Marie Fischer it turns out that:
Safari will not be able to submit a form to a page that is protected by .htaccess
(which limits POST) if the .htaccess
file includes an ErrorDocument like:
ErrorDocument 401 /errors/401.php