| 
 
 
 | 
| Keep Server Online 
 If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
 
 or
 
 
   
 A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
 
 Thank You! Steffen
 
 Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |  | 
 | 
| | 
| | 
|  Topic: Authentication problem with mod_jk |  |  
| Author |  |  
| arN34 
 
 
 Joined: 29 Sep 2006
 Posts: 1
 
 
 | 
|  Posted: Fri 29 Sep '06 18:32    Post subject: Authentication problem with mod_jk |   |  
| 
 |  
| Hi ! 
 I use Apache and Tomcat together, linked via mod_jk
 
 I have configured Apache for authentication based on HTTP Basic. That works like a charm if I access Apache htdocs subdirectories, but when I set Apache to redirect to Tomcat using mod_jk, the authentication is bypassed. So I can access freely my web app, not having to authenticate anywhere !
 
 Here is what I did in httpd.conf :
 
 1) link Apache/Tomcat :
 LoadModule jk_module modules/mod_jk.so
 #
 # Mod_jk settings
 #
 JkWorkersFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/workers.properties"
 JkLogFile "C:/Program Files/Apache Software Foundation/Apache2.2/logs/mod_jk.log"
 JkLogLevel warning
 JkMount /commandes default
 JkMount /commandes/* default
 # End of mod_jk settings
 
 => it works (http://localhost/myappl is redirected to Tomcat) !
 
 
 2) vhosts (I use both http and https) :
 NameVirtualHost *:80
 NameVirtualHost *:443
 
 <VirtualHost *:80>
 RewriteEngine On
 RewriteRule ^/$ http://myserver.dyndns.org/commandes [R,L]
 
 </VirtualHost>
 
 
 <VirtualHost *:443>
 SSLEngine On
 SSLCertificateFile conf/newcert.pem
 SSLCertificateKeyFile conf/nopwkey.pem
 
 RewriteEngine On
 RewriteRule ^/$ https://myserver.dyndns.org/commandes [R,L]
 
 </VirtualHost>
 
 => it works : http://localhost and https://localhost are redirected to Tomcat
 
 
 3) http basic authentication in <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"> :
 #Access is managed by :
 Order allow,deny
 Allow from all
 
 #And here is the authentication
 AuthUserFile auth/.htpasswd
 AuthName "Accès Sécurisé"
 AuthType Basic
 Require valid-user
 
 => I have no authentication : I am directly redirected to my web app
 
 
 3 bis) I make a test with a vhost1 directory in htdocs and no more redirection to my webapp in the virtualhost :
 <VirtualHost *:80>
 DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/vhost1"
 
 </VirtualHost>
 
 => authentication works when I enter http://localhost !
 But if I enter http://localhost/myapp here again no login popup prompts and I'm directly taken to my webapp
   
 What is wrong iin my config ?
 
 Did you ever heard about that ?
 
 Here is my httpd.conf :
 
 
 Admin note:
 httpd.conf removed, see Forum Rules
 |  |  
| Back to top |  |  
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Thu 02 Nov '06 13:46    Post subject: |   |  
| 
 |  
| If you want a second auth, when you access the app, you can't have a auth in the root. To have a second auth, you have to change the REALM and a different user.
 
 If you call the app by a link that would be easy.
 
 http://wrongusername:wrongpassword@server.tld/app
 
 Or you have to create .htaccess file in the app folder and "ask" for a different user
 |  |  
| Back to top |  |  
| Jorge 
 
 
 Joined: 12 Mar 2006
 Posts: 376
 Location: Belgium
 
 | 
|  Posted: Thu 02 Nov '06 14:25    Post subject: |   |  
| 
 |  
|  	  | James Blond wrote: |  	  | If you want a second auth, when you access the app, you can't have a auth in the root. To have a second auth, you have to change the REALM and a different user.
 
 If you call the app by a link that would be easy.
 
 http://wrongusername:wrongpassword@server.tld/app
 
 Or you have to create .htaccess file in the app folder and "ask" for a different user
 | 
 http://user:pass@host:port/uri doesn't work anymore, it was removed from IE6, IE7 and firefox
 |  |  
| Back to top |  |  
 
 | 
 |  | 
 |  |