You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Björn Lindström <bk...@elektrubadur.se> on 2003/11/01 17:33:26 UTC

[users@httpd] POSTing to index.cgi

I want to have a script (a wiki script, called index.cgi) generate any
page requested in my public_html directory.

It works, until I want to change a page, at which point a POST to
index.cgi is needed. This only works as long as I actually call it
as ~bkhl/index.cgi

If I request it under the name ~bkhl/, the POST is apparently dropped,
and no changes can be made. This is of course very unsatisfactory. Does
anyone have a clue on what to do about this? Here are the relevant lines
from my .htaccess:

AddHandler cgi-script cgi

Options +ExecCGI

DirectoryIndex index.cgi index.html

RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^([^/?]+)$ /~bkhl/index.cgi/$1 [L,QSA]


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: POSTing to index.cgi

Posted by Björn Lindström <bk...@elektrubadur.se>.
Joshua Slive <jo...@slive.ca> writes:

> I can't tell what you are asking.  "/~bkhl" is not a valid URL for the
> resource in question.  The valid URL is "/~bkhl/".  Apache tries to be
> nice and redirect the client from the former to the latter, but a
> client typically converts POST to GET as part of the redirect, thereby
> losing any POST data.

That means I will have to hack the wiki script a bit to get it
working. Right now, it (OddMuse) assumes that the base URI for the wiki
(that it uses as a base for internal linking) is the same as the script
name, which means that if I would set it to "/~bkhl/", it creates
internal links like "http://host.domain/~bkhl//PageName".

It should be pretty trivial fixing that in the script, now that I get
what the problem is. Thanks for helping me find a clue.

-- 
Björn Lindström <bk...@elektrubadur.se>
http://bkhl.elektrubadur.se/


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: POSTing to index.cgi

Posted by Joshua Slive <jo...@slive.ca>.
On Sat, 1 Nov 2003, Björn Lindström wrote:
> Joshua Slive <jo...@slive.ca> writes:
> > Are you absolutely sure that you are posting to "/~bkhl/" and not
> > "/~bkhl"?  The trailing slash is crucial.
>
> Hmm, that might be it. Is there some way to rewrite "/~bkhl/" to
> "/~bkhl", from ~bkhl/public_html/.htaccess (I have no possibility to
> configure the server, other then via .htaccess.)

I can't tell what you are asking.  "/~bkhl" is not a valid URL for the
resource in question.  The valid URL is "/~bkhl/".  Apache tries to be
nice and redirect the client from the former to the latter, but a client
typically converts POST to GET as part of the redirect, thereby losing any
POST data.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: POSTing to index.cgi

Posted by Björn Lindström <bk...@elektrubadur.se>.
Joshua Slive <jo...@slive.ca> writes:

> On Sat, 1 Nov 2003, Björn Lindström wrote:
>> If I request it under the name ~bkhl/, the POST is apparently dropped,
>> and no changes can be made. This is of course very unsatisfactory. Does
>> anyone have a clue on what to do about this? Here are the relevant lines
>> from my .htaccess:
>>
>> AddHandler cgi-script cgi
>>
>> Options +ExecCGI
>>
>> DirectoryIndex index.cgi index.html
>>
>> RewriteEngine On
>> RewriteCond %{QUERY_STRING} ^$
>> RewriteRule ^([^/?]+)$ /~bkhl/index.cgi/$1 [L,QSA]
>
> Are you absolutely sure that you are posting to "/~bkhl/" and not
> "/~bkhl"?  The trailing slash is crucial.

Hmm, that might be it. Is there some way to rewrite "/~bkhl/" to
"/~bkhl", from ~bkhl/public_html/.htaccess (I have no possibility to
configure the server, other then via .htaccess.)

> What does "the POST is apparently dropped" mean?  Does it get
> converted to a GET?  Do you get an error message?

The post should be to the script, without any arguments, so what I get
is just the main page of the wiki. This is what makes me think the POST
is disappearing somewhere along the line.

> Exactly what version of apache and what modules are you using?

The server is Apache/2.0.40 and this should be the complete list of
modules:

access_module
actions_module
alias_module
asis_module
auth_anon_module
auth_dbm_module
auth_digest_module
auth_module
autoindex_module
cern_meta_module
cgi_module
cgid_module
dav_fs_module
dav_module
dir_module
env_module
expires_module
headers_module
imap_module
include_module
info_module
log_config_module
mime_magic_module
mime_module
proxy_connect_module
proxy_ftp_module
proxy_http_module
proxy_module
rewrite_module
setenvif_module
speling_module
status_module
unique_id_module
userdir_module
usertrack_module
vhost_alias_module


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] POSTing to index.cgi

Posted by Wouter van Vliet <wo...@springt.nl>.
I'm having quite a similar problem:

My RewriteRule is:

  RewriteRule ^/backoffice\/(.*)$
/home/web/comicstripshop/cgi-bin/backoffice/index.pl?r=$1 [QSA] 

It recieves requests like: www.host.com/backoffice/page/subpage, translating
them to: {path}/index.pl?r=page/subpage

What goes wrong in my situation is that not the POST but the GET variables
are seeming to get lost when posting to /backoffice/page/subpage. Getting
lost in this is that I cannot find the variables anywhere in the perl $CGI
object. Lost, gone, absent.. Thus meaning that I cannot build the page it is
requesting.

Versions:
	RedHat Linux 9.0
	Apache: Apache/2.0.40
	ModPerL: 1.99.07

Hope this helps tracing down Bjorn's question, as well as well .. Solving my
own of course. Right now I'm using the GET method for forms as a temporary
solution...

Wouter


-----Original Message-----
From: Joshua Slive [mailto:joshua@slive.ca] 
Sent: Saturday 01 November 2003 18:38
To: users@httpd.apache.org
Subject: Re: [users@httpd] POSTing to index.cgi


On Sat, 1 Nov 2003, Björn Lindström wrote:
> If I request it under the name ~bkhl/, the POST is apparently dropped, 
> and no changes can be made. This is of course very unsatisfactory. 
> Does anyone have a clue on what to do about this? Here are the 
> relevant lines from my .htaccess:
>
> AddHandler cgi-script cgi
>
> Options +ExecCGI
>
> DirectoryIndex index.cgi index.html
>
> RewriteEngine On
> RewriteCond %{QUERY_STRING} ^$
> RewriteRule ^([^/?]+)$ /~bkhl/index.cgi/$1 [L,QSA]

Are you absolutely sure that you are posting to "/~bkhl/" and not "/~bkhl"?
The trailing slash is crucial.

What does "the POST is apparently dropped" mean?  Does it get converted to a
GET?  Do you get an error message?

Exactly what version of apache and what modules are you using?

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] POSTing to index.cgi

Posted by Joshua Slive <jo...@slive.ca>.
On Sat, 1 Nov 2003, Björn Lindström wrote:
> If I request it under the name ~bkhl/, the POST is apparently dropped,
> and no changes can be made. This is of course very unsatisfactory. Does
> anyone have a clue on what to do about this? Here are the relevant lines
> from my .htaccess:
>
> AddHandler cgi-script cgi
>
> Options +ExecCGI
>
> DirectoryIndex index.cgi index.html
>
> RewriteEngine On
> RewriteCond %{QUERY_STRING} ^$
> RewriteRule ^([^/?]+)$ /~bkhl/index.cgi/$1 [L,QSA]

Are you absolutely sure that you are posting to "/~bkhl/" and not
"/~bkhl"?  The trailing slash is crucial.

What does "the POST is apparently dropped" mean?  Does it get converted to
a GET?  Do you get an error message?

Exactly what version of apache and what modules are you using?

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: POSTing to index.cgi

Posted by Björn Lindström <bk...@elektrubadur.se>.
bkhl@elektrubadur.se (Björn Lindström) writes:

> I want to have a script (a wiki script, called index.cgi) generate any
> page requested in my public_html directory.
>
> It works, until I want to change a page, at which point a POST to
> index.cgi is needed. This only works as long as I actually call it
> as ~bkhl/index.cgi

I might add that I have tried to reach the same effect using only
mod_rewrite, with the same bad results. Here is what that looked like:

RewriteEngine On

# If there's no query string, change the page name part into a query.
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^([^/]+)$ /~bkhl/cgi-bin/home.pl?$1 [QSA,L]

# Otherwise, do a plain redirect.
RewriteRule ^$ /~bkhl/cgi-bin/home.pl [QSA,L]


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org