Tuesday, August 30, 2022

[SOLVED] Apache httpd server authentication

Issue

I am running the Apache HTTP Server and JBoss Server in the same host.I am redirecting the request from Apache HTTP Server to Jboss. Now I want to authenticate the request in the Apache server.(It will be used for SSO in the future.)

Please mention if there are any changes/additional steps that needs to be done while redirecting.

Please find the changes made in the httpd.conf file.

<VirtualHost "IP":443>  
        # Proxy Settings 
        ProxyRequests Off
        ProxyPreserveHost On

        # AJP support
        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / ajp://localhost:8009/
        ErrorDocument 503 /test.html
        RedirectMatch 301 ^/WebApp/(.*)$ /$1
        RedirectMatch 301 ^/WebApp$ / 

        <Location "IP":443>
           Options FollowSymLinks
           AuthBasicAuthoritative On   
           AuthType Basic
           AuthName "Restricted Files"
           AuthBasicProvider file
           AuthUserFile "File Path"
           Require user TestUser
           AllowOverride AuthConfig
           Order allow,deny
           Allow from all
        </Location>

</VirtualHost>

<VirtualHost "IP":80>
        Redirect / https://"IP"
        #ProxyPass / ajp://localhost:8009/
        #ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>

Please help me out with this.


Solution

Location does not take ip and port, just virtual paths from documentroot. Also it seems that Allow from all and basic auth in the same place do not make much sense either.



Answered By - ezra-s
Answer Checked By - Senaida (WPSolving Volunteer)