Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Directory protection under .htaccess

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-04-11
Hi, experts:

I have a domain under a Linux 7.2 Server. I use there that .htaccess/.htpasswd scheme to control access to some directories. It normally works in this way: when I enter the protected directory the first time, it asks the user/password. If I leave the site through the browser's back button and I return by the forward button it doesn't ask the user/password, until I cancel the browser and call it again. If I kill the browser, so when I enter the protected directory again it asks the user/password. That's ok.

But now I realized that, specifically at some computers of my office (and I don't know why), even if I kill the browser, it doesn't ask the user/password when I enter the protected directory again.

Question: Would it be any specific Internet option of the browser? Could it be any option of the .htaccess file. I am using this file set:

AuthType Basic
AuthName "Private access"
AuthUserFile /home/scoposl/www/cgi-scoposl/protect/.htpasswd1
require valid-user

Thanks for any help.

Mario Jorge Lima./
Question by:multisites

Accepted Solution

herrmann1001 earned 300 total points
ID: 7981517
definitly a browser problem. Which browser do you use?, (the one with the problems)

It could be so that the browser caches the page, and reads it directly from disc, instead of requesting it again over the network. And thus, it appears that you didnt have to log in.

Best of times!

Expert Comment

ID: 7981613
You need to control caching on the server side, this is not a browser problem. This is done primarily through your web server...or commands in your .htacces file.  For instance with Apache web servers you can includet this command header in htacces

NauAuthBrowserCache enabled

This directive allows you to control client browser page caching behavior and can be set to either "enabled", "disabled", or left out completely. The default (if this directive is not present or is set to something other than a valid keyword) is the same as if you had specified "enabled", which enables normal browser caching. By setting this directive to "disabled" the web developer can force web content protected by their .htaccess file to be "pre-expired". This forces compliant browsers to request a fresh copy of the web pages each time the user tries to view them.


Author Comment

ID: 7982726

What you say really makes sense, but I tried it putting that directive you mention in my .htaccess file and it didn't accept it, for when I access the directory by the browser it returns a Server Internal Error. I don't know if the sintax is right or what should be the position of the directive in the sequence of commands.

I am running under a Linux 7.2 with Apache 1.3.27. I have been searching the Apache organization website, and I didn't find any reference to that directive you mentioned.

Well, anyway, I thank you for help, and if you have any more hint about what I could do, thanks in advance.


Expert Comment

ID: 7992531
otherwise you can use a meta-tagg for the html-files you have under the procetive area.

<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

If you a tag like this in your header, adjust that the expire is set to a date or time before present time.
This will force your browser to get a new copy from the server when you hit the back button.

And Noulette, explain to me how an actual request from an browser goes?.

I say it is like this:
 User input an URL,
 browser analyses URL,
 if exists in browser cache, read from cache,
   if cached page not expired, show page to user.
      request page from server. (via proxy..)
   request page from server.
 show page to user.

If we agree about this, exlain to me how it can be a server side problem then? Besides if browsercache is turn off.

best of times!

Expert Comment

ID: 9816126
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately one week.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:

EE Page Editor

Featured Post

Managing Security Policy in a Changing Environment

The enterprise network environment is evolving rapidly as companies extend their physical data centers to embrace cloud computing and software-defined networking. This new reality means that the challenge of managing the security policy is much more dynamic and complex.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts Exchange expands question security options for members.
The Internet has made sending and receiving information online a breeze. But there is also the threat of unauthorized viewing, data tampering, and phoney messages. Surprisingly, a lot of business owners do not fully understand how to use security t…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question