.htaccess Password Protected Website Requires Password Each Time I Reload the Page on iPad

I use .htaccess to protect the website with a password.

If I use html5 audio elements on this website, the iPad requires a website password with every reboot, although it is saved in the browser.

Only on iPad. Not rooted, all original ios. Tested with Chrome and Safari on iPad, always the same.

If there is no audio element on the page, no password is required.

This does not happen on Android Tablet or Firefox on Windows.

What can I program to prevent the iPad from asking for a password?

I am using the following code on this website.

<!DOCTYPE HTML> <html> <head> <title>Audio</title> </head> <body> <script> function play(){ var audio = document.getElementById("audio"); audio.play(); } </script> <input type="button" value="PLAY" onclick="play()"> <audio id="audio" src="./207.wav"></audio> </body> </html> 

.htaccess:

 AuthType Basic AuthName name123 AuthUserFile /somepath/.htpasswd require valid-user SetEnv no-gzip ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType text/html "access plus 1 seconds" AddDefaultCharset UTF-8 
+5
source share
1 answer

This is a very old problem . Safari browser disables sending auth parameters when doing something automatically - redirect with 301-302 http codes or upload a multimedia file. This seems to be a security issue - Safari does not allow access to a file downloaded automatically.

Let me check it with the server logs (I added an image to the page):

GET /t/i.jpg HTTP/1.0" 200 images uploaded perfectly.

GET /t/207.wav HTTP/1.0" 401 sound not loaded, prompt is displayed.

So, this is an audio file that causes the auth prompt to show. There is a workaround , but it is not safe enough.

UPD The following code shows a 200 response for the first access ( img tag) to 207.wav and 401 for the second ( audio tag).

 <img src="./207.wav" width=200><br> <audio id="audio" src="./207.wav"></audio> 217.118.81.250 - ivan [11/Feb/2017:20:32:13 +0300] "GET /t/207.wav HTTP/1.0" 200 ... Safari/602.1" 217.118.81.250 - - [11/Feb/2017:20:32:15 +0300] "GET /t/207.wav HTTP/1.0" 401 ... Safari/602.1" 
+3
source

Source: https://habr.com/ru/post/1262178/


All Articles