Apache is listening on port 80 and redirecting everything to https, which is handled by stunnel. If I put in authentication in it redirects before it does the authentication. Is there a way to handle this?
Listen 80
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^(.*) https://%{HTTP_HOST}$1
<Directory /*>
AuthType Basic
AuthName "Stooges Web Site: Login with email address"
AuthLDAPURL ldap://localhost:389/o=stooges?mail
require valid-user
</Directory>
</VirtualHost>
update: I use stunnel instead of apache, because apache can't handle websockets with ssl and stunnel can.