Apache executing cgi-scripts inside .htaccess protected directories

Apache executing cgi-scripts inside .htaccess protected directories

Post by Bill Cha » Thu, 18 Jul 1996 04:00:00


Is it possible to execute cgi scripts in .htaccess protected directories,
and to have these scripts call other scripts in the same directory?

I'm using CGI scripts to generate forms. The scripts are located in
directories protected by a .htaccess mechanism. The action for the first
form (lets call it foo.cgi) is a second cgi script (let's call it test.cgi).

Let's say that foo.cgi (written in tcl) has something like.

puts "Content-type: text/html\n"
puts "<Head>"
puts "</head>"
puts "<BODY >"
puts "<FORM ENCTYPE=\"multipart/form-data\" NAME = form_er METHOD=POST
puts "<H3>File Information</H3>"
puts ""
puts "CAD System  :<SELECT NAME=\"cadsrc\"> "
puts "            <OPTION> Pro/Engineer"
puts "            </SELECT> <P>"
puts "<input type = submit value = \" Send \">     <INPUT TYPE=reset
VALUE=\" Clear Entries \">"
puts "</FORM>"

Assuming that all test.cgi does is print out the environment variables.

puts "Content-type: text/html\n"
puts "<HTML>"
puts "<HEAD>"
puts "<TITLE>User  has been registered</TITLE>"
puts "</HEAD>"
puts "<BODY >"
foreach name [array names env] {
      puts "$name is  $env($name) <br>"


puts "</BODY>"
puts "</HTML>"

The problem I'm having is that having authenticated properly to foo.cgi,
the authentication is not recognized when I "submit" the action (and
try to execute test.cgi). If I place test.cgi in an unprotected directory,
I have no problem completing the action from foo.cgi. BUT, I no longer
have the REMOTE_USER environment variable properly set (which I
need for my application). I have no problem executing test.cgi directly
(i.e., opening http://my.www.server/test.cgi)....I simply authenticate
and the REMOTE_USER variable is set and echoed back to me.
All of this is with Apache 1.0.2.

Any help with this matter would be appreciated.


1. Problem running a CGI in a htaccess protected directory

I am sure this problem has been addressed before but I looked at every message and I didn't find it...

I am trying to run a CGI in a password protected directory.  The CGI calls itself and I am prompted
again for the password, which when entered is unrecognized.  Any ideas would be greatly appreciated.

Thank you.
Robert S. Bennett
ADGRAFIX Graphic Design/Web Services
Boston, MA

Web Site: http://www.adgrafix.com

2. External SCSI Connector on NCR PCI Fast SCSI2 cards ???

3. apache: CGI-scripts using PATH_TRANSLATED, .htaccess

4. Hardware recommends for ipchains, postfix, squid and bind

5. Apache error when executing cgi-scripts

6. Help fixing UT .ini file

7. Protecting CGI-Scripts with passwords

8. G400/XFree 4.0.2, how to enable hardware acceleration for OpenGL/Mesa?

9. Apache and CGI executed from /home directory.

10. CGI won't execute - cgi pointing into htdocs directory

11. Apache: .htaccess & cgi scripts

12. How can I get a CGI script to auto execute under Apache 1.1.1

13. apache suexec not executing ~user/script.cgi