Author |
|
AvK
Joined: 31 May 2014 Posts: 5 Location: The Netherlands, Amsterdam
|
Posted: Sat 31 May '14 10:29 Post subject: Apache asks to login twice |
|
|
Hi all,
My problem: Apache 2 asks me twice to login
Versions: Apache 2, Ubuntu 12.04.4 LTS
My situation:
1) I have a Linux server (Ubuntu) which runs an Apache 2 server on server.name1.com
2) I have a second URL (www.url.net) registered with DynDNS that I have redirected to server.name1.com.
3) Thus typing server.name1.com or www.url.net in my browser brings up the web-pages (a WIKI implemented with foswiki.org) hosted on my server. So far so good.
4) In my Apache configuration file, I have the following:
<VirtualHost *:80>
ServerName server.name1.com
Redirect / http://www.url.net/foswiki/
</VirtualHost>
<VirtualHost *:80>
ServerName www.url.net
ServerAdmin user@gmail.com
DocumentRoot "/home/Foswiki-1.1.9/"
#Redirect DocumentRoot to Main web of foswiki
RedirectMatch ^/$ http://www.url.net/foswiki/
etc etc
</VirtualHost>
Thus, when I type server.name1.com in my browser it will automatically redirect to http://www.url.net/foswiki and show this URL in the address bar of the browser. This is working fine also.
4) Part of the files pointed to from my website (the directory /home/Data) have restricted access for which I use a .htpasswd file. Therefore, in the second VirtualHost (above) I have the following construct:
<Directory "/home/Data">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
AuthUserFile /home/Foswiki-1.1.9/data/.htpasswd
AuthName 'Restricted files'
AuthType Basic
Require valid-user
</Directory>
Now the following happens:
A) I type www.url.net in my browser
B) Now FosWiki displays the web page located at www.url.net/foswiki
C) Next I ask for a foswiki page with restricted access (say RestrictedPage.html) and subsequently the foswiki authorisation mechanism asks for a username/password (which is also checked against /home/Foswiki-1.1.9/data/.htpasswd)
D) After supplying username/password, i am logged on and the web page is displayed but......
E) The web page RestrictedPage.html contains an image tag (<img src="http://server.name1.com/images/figure.png">; with images pointing to my restricted data directory /home/Data) and therefore (in microsoft explorer) I am prompted for a second time for my username and password (in Chrome the figure simply isn't displayed).
As far as I understood from other messages in various forums this has to do with the fact that although www.url.net and server.name1.com point to
the same server/web site they require separate authorisations since they are not recognized as being the same server name (?). Nevertheless, I haven't been able to solve this issue (eg using UseCanonicalName on/off at various place in my apache configuration file).
Question: how can I configure my Apache server such that I'm only prompted once for username/password?
Any help is appreciated.
Antoine |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 02 Jun '14 12:12 Post subject: |
|
|
Since the image src is on a second domain (at least of the browser) apache asks for the password. Make sure that all stuff is one the same domain. |
|
Back to top |
|
AvK
Joined: 31 May 2014 Posts: 5 Location: The Netherlands, Amsterdam
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 04 Jun '14 15:14 Post subject: |
|
|
PLease look into your access logs for the 401 and 403 error to see which requests causes a login. I hope you have seperated logs for each vhost. |
|
Back to top |
|
AvK
Joined: 31 May 2014 Posts: 5 Location: The Netherlands, Amsterdam
|
Posted: Wed 04 Jun '14 19:58 Post subject: |
|
|
Hi,
I looked at the apache error log and access log. Only the access log contains entries related to my problem.
Below is part of the access log. To view the page 'OptredensRecover' I have to enter my username/password. This page contains a link to "AantalOptredens_2003-2012.png" (also shown below). This image doesn't display until i click on it after which I have to re-enter my username/password.
I just don't understand what is going on.
THanks,
Antoine
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:07 +0200] "GET /foswiki/pub/System/PatternSkinThemeFatWilly/menu_background.gif HTTP/1.1" 200 701 "http://recover.does-it.net/foswiki/Recover/WebHome?validation_key=67daee0518f58f019683ae7f6663a9fe" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:07 +0200] "GET /foswiki/pub/System/PatternSkinThemeFatWilly/topicactions_background.gif HTTP/1.1" 304 189 "http://recover.does-it.net/foswiki/Recover/WebHome?validation_key=67daee18f58f019683ae7f6663a9fe" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:07 +0200] "GET /foswiki/pub/System/PatternSkinThemeFatWilly/header.gif HTTP/1.1" 304 189 "http://recover.does-it.net/foswiki/Recover/WebHome?validation_key=67daee0518f58f0183ae7f6663a9fe" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
h2294580.stratoserver.net:80 ::1 - - [04/Jun/2014:19:36:12 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:13 +0200] "GET /foswiki/bin/view/Recover/OptredensRecover HTTP/1.1" 302 533 "http://recover.does-it.net/foswiki/Recover/WebHome?validation_key=67daee0518f58f019683ae6663a9fe" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
h2294580.stratoserver.net:80 ::1 - - [04/Jun/2014:19:36:13 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:13 +0200] "GET /foswiki/Recover/OptredensRecover HTTP/1.1" 200 14477 "http://recover.does-it.net/foswiki/Recover/WebHome?validation_key=67daee0518ff019683ae7f6663a9fe" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:14 +0200] "GET /foswiki/pub/System/PatternSkinThemeFatWilly/bullet-toc.gif HTTP/1.1" 304 188 "http://recover.does-it.net/foswiki/Recover/OptredensRecover" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
h2294580.stratoserver.net:80 84.27.112.209 - - [04/Jun/2014:19:36:14 +0200] "GET /data/Recover/Images/AantalOptredens_2003-2012.png HTTP/1.1" 302 584 "http://recover.does-it.net/foswiki/Recover/OptredensRecover" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:14 +0200] "GET /foswiki/data/Recover/Images/AantalOptredens_2003-2012.png HTTP/1.1" 401 624 "http://recover.does-it.net/foswiki/Recover/OptredensRecover" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
h2294580.stratoserver.net:80 ::1 - - [04/Jun/2014:19:36:14 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
h2294580.stratoserver.net:80 ::1 - - [04/Jun/2014:19:36:15 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
h2294580.stratoserver.net:80 ::1 - - [04/Jun/2014:19:36:21 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
h2294580.stratoserver.net:80 ::1 - - [04/Jun/2014:19:36:22 +0200] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
recover.does-it.net:80 66.249.78.79 - - [04/Jun/2014:19:39:46 +0200] "GET /foswiki/bin/rdiff/System/PatternSkinHorizontalNavigationExample?type=history HTTP/1.1" 200 3307 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
recover.does-it.net:80 66.249.78.79 - - [04/Jun/2014:19:43:34 +0200] "GET /foswiki/bin/view/MyStudio/MyProjects?cover=print HTTP/1.1" 302 550 "-" "Mozilla/5.0 |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 05 Jun '14 15:48 Post subject: |
|
|
I see there only a single line of login.
recover.does-it.net:80 84.27.112.209 - - [04/Jun/2014:19:36:14 +0200] "GET /foswiki/data/Recover/Images/AantalOptredens_2003-2012.png HTTP/1.1" 401 624 "http://recover.does-it.net/foswiki/Recover/OptredensRecover" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
What is with the login to the page? |
|
Back to top |
|
AvK
Joined: 31 May 2014 Posts: 5 Location: The Netherlands, Amsterdam
|
Posted: Sat 07 Jun '14 9:50 Post subject: |
|
|
Hi James Blond,
I'm not sure what you mean. However, I created a test account.
If you go to:
http://recover.does-it.net/foswiki/TestWeb/WebHome
then you can login with
Username: JamesBlond
Password: jamesblond
You will see what is the problem.
I also just found out that when I'm prompted for the second time for a username/password and then press 'cancel' and hit the browser back button, the figure displays correctly. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 07 Jun '14 11:24 Post subject: |
|
|
I don't get any login stuff from apache itself. I just see the wiki login page and can't login. |
|
Back to top |
|
AvK
Joined: 31 May 2014 Posts: 5 Location: The Netherlands, Amsterdam
|
Posted: Sat 07 Jun '14 12:18 Post subject: |
|
|
I don't understand, when I look at the wiki log file I see that you could log in
| 2014-06-07T08:27:25Z info | JamesBlond | login | TestWeb.WebHome | AUTHENTICATION SUCCESS - JamesBlond - Firefox | 79.68.66.60 | |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|