Hi all
I’m using excel to perform a webquery which is assigned to a macro in order to refresh the data.
My directory structure looks like this
/testwebpage
.htaccess
|--cgi-bin---|
Test.cgi
|---Admin-|
.htaccess
Test2.cgi
|---passwd-|
.htpasswd
The DocumentRoot is testwebpage
When the user enters this in the browser
http://mytestsite.com/
The .htaccess file in the root directory testwebpage contains
DirectoryIndex cgi-bin/test.cgi
This will redirect the request to test.cgi inside the cgi-bin directory.
When the users enters this
http://mytestsite.com/cgi-bin/admin/test.cgi
The admin directory contains an .htaccess file which looks like this
AuthUserFile /home/user/testwebpage/passwd/.htpasswd
AuthGroupFile /dev/null
AuthName "protected site"
AuthType Basic
<Limit GET>
require valid-user
</Limit>
Inside the browser the password dialog box appears and they are able to enter the password and username just fine.
Inside excel when the user presses the button to run the macro
Run time error 1004
Unable to open
http:// http://mytestsite.com/cgi-bin/admin/test.cgi
The hyperlink cannot be followed to the destination
If I was to edit the .htaccess file in the root directory testwebpage
From
DirectoryIndex cgi-bin/test.cgi
To
#DirectoryIndex cgi-bin/test.cgi
Commenting this line will get rid of the run time error message.
However this will mean users are unable to reach my index page which is test.cgi inside the cgi-bin.
I’ve also noticed when I remove the .htaccess file in the admin directory the macro will work fine however without authentication.
I’ve used wireshark tool to monitor the http packets when the macro is run.
A http options request is sent from the server to the client, but no http response from the client to the server with a 200 ok status.
I’ve noticed when I comment out this line
#DirectoryIndex cgi-bin/test.cgi
Inside .htaccess file in the root directory testwebpage. The client will reply with 200 ok status to the options request from the server.
Also when I remove the .htaccess file inside the admin directory and also uncomment this line
DirectoryIndex cgi-bin/test.cgi
I run the macro again to view if the http packets where different
The client responses with 200 ok status including this line
Allow: GET,HEAD,POST,OPTIONS,TRACE\r\n
This was missing in the 200 ok response when I left the .htaccess file inside the admin directory.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.