0

I've enabled mod_status for my own use under Apache/2.4.6 in my Windows 10 development box:

<Location /server-status>
    SetHandler server-status
    Require host localhost
    Require host example
    Require host example.com
    Require ip 127.0.0.1
</Location>

(example and example.com represent my Windows Active Directory host name.) I'm also using name-based virtual hosts and I have a default host that roughly looks like this:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "C:/Sites/Default/htdocs"
    FallBackResource /index.php

    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common

    <Directory "C:/Sites/Default/htdocs">
        Require all granted
        AllowOverride All
        Options -Indexes
    </Directory>
</VirtualHost>

... and works fine: any host name or IP address that's not explicitly configured displays my PHP-powered Site does not exist error page, including http://localhost/.

I can access server info successfully through any of the hosted sites or right though IP address:

http://some.other.site.example.org/server-status
http://127.0.0.1/server-status

However, using localhost as host name triggers a 403 Forbidden status code:

http://localhost/server-status
AH01753: access check of 'localhost' to /server-status failed, reason: unable to get the remote host name
AH01753: access check of 'example' to /server-status failed, reason: unable to get the remote host name
AH01753: access check of 'example.com' to /server-status failed, reason: unable to get the remote host name
AH01630: client denied by server configuration: C:/Sites/Default/htdocs/server-status

I've tried removing localhost from the ServerName directive of my default vhost but I'm still getting Forbidden.

What's causing localhost to be an exception?

1
  • As usual, I had to ask in a forum to find the solution myself. I've shared it here in case it helps others; feel free to correct any error. Feb 10 '17 at 8:51
0

localhost is resolving to an IPv6 address so I need to add this:

Require ip ::1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.