Tomcat version:8.0.43.0
Nginx  version:openresty/1.11.2.2
OS:CentOS Linux release 7.3.1611 (Core)


I have already configure tomcat to use the DIGEST certification,
When I have direct access to Tomcat  all normal,
http://192.168.122.130:8080/sample/test/test.html  can trigger the 
certification and passed.
But when I through the nginx proxy access,
http://192.168.122.130/tomcat/sample/test/test.html   have a few problems,can 
trigger the certification but can't passed ,repeated authentication dialog.
CATALINA_HOME/conf/server.xml:
<Context path="/sample" docBase="/home/coremail/tomcat/webapps_exp/sample">
                <Realm className="org.apache.catalina.realm.LockOutRealm">
                <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                     resourceName="UserDatabase" digest="MD5"/>  
                </Realm>
            </Context>


CATALINA_HOME/conf/tomcat-users.xml :
<role rolename="testuser"/>
  <user username="testdigest" password="7dc963c3bdf9849f880b9562c5b08cf1" 
roles="testuser"/>


CATALINA_HOME/webapps_exp/sample/WEB-INF/web.xml :
<security-constraint>
       <web-resource-collection>
         <web-resource-name>
             my sample webapp
         </web-resource-name>
         <url-pattern>/test/*</url-pattern>
       </web-resource-collection>
       <auth-constraint>
           <role-name>testuser</role-name>
       </auth-constraint>
    </security-constraint>


    <login-config>
         <auth-method>DIGEST</auth-method>
         <realm-name>webapp</realm-name>
    </login-config>


    <security-role>
      <role-name>testuser</role-name>
    </security-role>


nginx.conf


location ~ /tomcat/ {
            rewrite ^/tomcat/(.*) /$1 break;
            proxy_pass http://192.168.122.130:8080;
}


Why cannot be accessed through the nginx and certified ? please help me ,thanks!

Reply via email to