You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Philip Collins <Ph...@unh.edu> on 2004/08/20 17:28:13 UTC

[users@httpd] unable to POST with mod_include

I am getting the "The requested method POST is not allowed for the URL"
when I try to post to a shtml file which includes some dynamic CGI
forms. I tried specifying the limit directive explicitly allowing GET
POST, to no avail. I did some web searches, and the only solution (that
is not really a solution) was to change the action of my forms to the
script the form is intended for. This is not what I really want. For
example, I have a web site with menus, search form, and footer - all are
constructed from separate html files - all included in one shtml file.
The web page loads correctly, then when I click the submit button with
some search terms, the form does a POST (GET is not an option), and I
get the error message. mod_include must have some way to do this. If
not, why not? This seems like a silly constraint. In the end, I was able
to get around all of this by using the Apache::SSI mod_perl module which
allows you to POST to a shtml file. I would rather stick to standard
apache modules if possible.

Here is my original conf file that doesn't work
...
    <Directory />
      AllowOverride None
      Options All
      Order Deny,Allow
      Deny from all
      Allow from all
      <Limit GET POST>
        Order Deny,Allow
        Deny from all
        Allow from all
      </Limit>
    </Directory>
...

Here is the one that does work using the Apache::SSI module
...
    <Files *.shtml>  # or whatever
      SetHandler perl-script
      PerlHandler Apache::SSI
    </Files>
...

If it matters here is my server info:
Server version: Apache/1.3.31 (Unix)
Server built:   Jul  9 2004 16:14:29
Server's Module Magic Number: 19990320:16
Server compiled with....
 -D EAPI
 -D HAVE_MMAP
 -D HAVE_SHMGET
 -D USE_SHMGET_SCOREBOARD
 -D USE_MMAP_FILES
 -D HAVE_FCNTL_SERIALIZED_ACCEPT
 -D HAVE_SYSVSEM_SERIALIZED_ACCEPT
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D DYNAMIC_MODULE_LIMIT=64
 -D HARD_SERVER_LIMIT=256
 -D HTTPD_ROOT="/usr/local/apache"
 -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/httpd.scoreboard"
 -D DEFAULT_LOCKFILE="logs/httpd.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 -D ACCESS_CONFIG_FILE="conf/access.conf"
 -D RESOURCE_CONFIG_FILE="conf/srm.conf"

Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_info.c
  mod_include.c
  mod_autoindex.c
  mod_dir.c
  mod_cgi.c
  mod_asis.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_rewrite.c
  mod_access.c
  mod_auth.c
  mod_proxy.c
  mod_usertrack.c
  mod_so.c
  mod_setenvif.c
  mod_ssl.c
  mod_perl.c

Thanks to anyone who can help me with this.

-- 
University Of New Hampshire
Morse Hall Room 219
39 College Road
Durham, NH 03825-3525
Philip.Collins@unh.edu
Ph:  (603) 862-7038
Fax: (603) 862-1761




---------------------------------------------------------------------
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] unable to POST with mod_include

Posted by Philip Collins <Ph...@unh.edu>.
On Fri, 2004-08-20 at 12:12, Joshua Slive wrote:
> On Fri, 20 Aug 2004 11:28:13 -0400, Philip Collins
> <ph...@unh.edu> wrote:
> > I am getting the "The requested method POST is not allowed for the URL"
> > when I try to post to a shtml file which includes some dynamic CGI
> > forms. I tried specifying the limit directive explicitly allowing GET
> > POST, to no avail. I did some web searches, and the only solution (that
> > is not really a solution) was to change the action of my forms to the
> > script the form is intended for. This is not what I really want. For
> > example, I have a web site with menus, search form, and footer - all are
> > constructed from separate html files - all included in one shtml file.
> > The web page loads correctly, then when I click the submit button with
> > some search terms, the form does a POST (GET is not an option), and I
> > get the error message. mod_include must have some way to do this. If
> > not, why not? 
> 
> A POST sends data to the script on stdin.  SSI pages have no way to read stdin.
> 
> Perhaps what you want is for one of the cgi scripts that you call from
> the SSI page to get the input on stdin.  But how is apache supposed to
> know which one?
> 
> In other words, POST is not supported for SSI pages for good reason. 
> Perhaps if you explained why you can't use GET we could provide some
> other options.

I understand what you are saying, but how else are you supposed to embed
self submitting POST forms in shtml pages? A self submitting form will
submit the form to the current uri. That way the header, menus, body,
and footer all appear after the form is submitted. GET forms have to
many limitations for many of the pages I work on. Static files should
ignore form input, and if there is more then one CGI script on a page,
then all scripts should have access to the form inputs. This is how
Apache::SSI works. Should there not be an option for mod_include to
allow this? How do other people approach this problem? I am trying to
offload all structure, and presentation to our HTML coders, and program
all the logic using perl scripts. The HTML forms are constructed by the
HTML coders with the help of the HTML::Template module. 

Thanks,

Phil

> 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
-- 
University Of New Hampshire
Morse Hall Room 219
39 College Road
Durham, NH 03825-3525
Philip.Collins@unh.edu
Ph:  (603) 862-7038
Fax: (603) 862-1761




---------------------------------------------------------------------
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] unable to POST with mod_include

Posted by Joshua Slive <js...@gmail.com>.
On Fri, 20 Aug 2004 11:28:13 -0400, Philip Collins
<ph...@unh.edu> wrote:
> I am getting the "The requested method POST is not allowed for the URL"
> when I try to post to a shtml file which includes some dynamic CGI
> forms. I tried specifying the limit directive explicitly allowing GET
> POST, to no avail. I did some web searches, and the only solution (that
> is not really a solution) was to change the action of my forms to the
> script the form is intended for. This is not what I really want. For
> example, I have a web site with menus, search form, and footer - all are
> constructed from separate html files - all included in one shtml file.
> The web page loads correctly, then when I click the submit button with
> some search terms, the form does a POST (GET is not an option), and I
> get the error message. mod_include must have some way to do this. If
> not, why not? 

A POST sends data to the script on stdin.  SSI pages have no way to read stdin.

Perhaps what you want is for one of the cgi scripts that you call from
the SSI page to get the input on stdin.  But how is apache supposed to
know which one?

In other words, POST is not supported for SSI pages for good reason. 
Perhaps if you explained why you can't use GET we could provide some
other options.

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


Re: [users@httpd] unable to POST with mod_include

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 20 Aug 2004, Philip Collins wrote:

> I am getting the "The requested method POST is not allowed for the URL"
> when I try to post to a shtml file which includes some dynamic CGI

You POST to a handler.  For HTML, including SSI, that's normally the
default handler that just sends a file back.  It doesn't accept POST.

You can POST to an appropriate handler, such as a CGI script.

-- 
Nick Kew

---------------------------------------------------------------------
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