Apache: "AuthType not set!" 500 Error

Apache

Apache Problem Overview


It's been a while since I used the Apache httpd web server. I'm firing up a local server for a project and when I try to request localhost/index.html, I get a 500 error and I see this in the error log:

[Tue Jan 21 09:23:58 2014] [crit] [client ::1] configuration error:  couldn't perform authentication. AuthType not set!: /index.html
[Tue Jan 21 09:23:58 2014] [error] an unknown filter was not added: DEFLATE
[Tue Jan 21 09:23:58 2014] [crit] [client ::1] configuration error:  couldn't perform authentication. AuthType not set!: /favicon.ico

It looks like there are possibly 2 errors here in the apache config, one related to "AuthType not set!" and possibly another related to "filter was not added: DEFLATE". I dont know what these means or where to start digging in.

A basic Google search revealed http://boinc.berkeley.edu/dev/forum_thread.php?id=8603">this link which indicates that the culprit may be "Require all granted". This line in my httpd.conf may be involved.

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

This apache config is mostly what is used in production for this project, so I know this works, just not currently on my workstation. What does this mean and what should I try next? I did try commenting out "Require all granted" and restarting apache but to no avail.

Following https://stackoverflow.com/questions/18064060/django-with-mod-wsgi-on-apache-500-error-authtype-not-set">this SO question I also loaded mod_authz_host

LoadModule authz_host_module modules/mod_authz_host.so

and added "Allow from all", restarted the server,. but the issue persists. The deflate issue appears to be unrelated, and was easily solved by adding

LoadModule deflate_module modules/mod_deflate.so

The question remains, how do I solve this 500 error?

[Tue Jan 21 09:44:20 2014] [crit] [client ::1] 
configuration error:  couldn't perform authentication. 
AuthType not set!: /index.html

Apache Solutions


Solution 1 - Apache

Remove the line that says

Require all granted

it's only needed on Apache >=2.4

Solution 2 - Apache

The problem here can be formulated another way: how do I make a config that works both in apache 2.2 and 2.4?

Require all granted is only in 2.4, but Allow all ... stops working in 2.4, and we want to be able to rollout a config that works in both.

The only solution I found, which I am not sure is the proper one, is to use:

# backwards compatibility with apache 2.2
Order allow,deny
Allow from all

# forward compatibility with apache 2.4
Require all granted
Satisfy Any

This should resolve your problem, or at least did for me. Now the problem will probably be much harder to solve if you have more complex access rules...

See also this fairly similar question. The Debian wiki also has useful instructions for supporting both 2.2 and 2.4.

Solution 3 - Apache

Alternatively, this solution works with both Apache2 version < 2.4 as well as >= 2.4. Make sure that the "version" module is enabled:

a2enmod version

And then use this code instead:

<IfVersion < 2.4>
    Allow from all
</IfVersion>
<IfVersion >= 2.4>
    Require all granted
</IfVersion>

Solution 4 - Apache

Just remove/comment the following line from your httpd.conf file (etc/httpd/conf)

Require all granted

This is needed till Apache Version 2.2 and is not required from thereon.

Solution 5 - Apache

I think that you have a version 2.4.x of Apache.

Have you sure that you load this 2 modules ?

  • mod_authn_core

  • mod_authz_core

    LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_core_module modules/mod_authz_core.so

PS : My recommendation for authorization and rights is (by default) :

LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so

Solution 6 - Apache

You can try sudo a2enmod rewrite if you use it in your config.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser3220334View Question on Stackoverflow
Solution 1 - ApacheStefanView Answer on Stackoverflow
Solution 2 - ApacheanarcatView Answer on Stackoverflow
Solution 3 - ApachepkoutView Answer on Stackoverflow
Solution 4 - ApacheCodedCoderView Answer on Stackoverflow
Solution 5 - ApacheGeorgioView Answer on Stackoverflow
Solution 6 - ApachesaianView Answer on Stackoverflow