List Info

Thread: 301 puzzlement




301 puzzlement
user name
2006-09-06 03:43:43
I am probably missing something obvious again but here's
something that 
has me puzzled.  I have a CGI program that executes for
every URL 
starting with /akasha.  But if I leave off the trailing
slash, I get a 
redirect to the URL with a /.  Ideally what should happen is
it 
shouldn't matter if there's a trailing slash, it should
just invoke the 
CGI and be done with it.  normally this is not a problem
when accessing 
pages but it is causing problems for CGI.  It would really
be nice to 
not have to remember to add that trailing /

what am I missing?

Directory /akasha {

     Handler cgi {
         ErrorHandler on
         scriptalias /var/www/scripts/default/ak_cgi.cgi

         # point to the akasha modules
         Env PYTHONPATH
"/usr/local/python/akasha"

         # point to the default css file
         Env AKASHA_CSS "/files/akasha.css"

         # base_path is the full pathname to the akasha data
store
         # don't forget the trailing slash
         # note: this path should not be exposed to the
outside world
         Env AKASHA_BASE_PATH
"/home/esj/projects/data-akasha/"

         # make this the same as the script name in
scriptalias
         Env AKASHA_SCRIPT "ak_cgi.cgi"
     }
}

*** ethereal capture.

GET /akasha HTTP/1.1
Host: 192.168.118.16
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0
.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive



HTTP/1.1 301 Moved Permanently
Connection: Close
Date: Tue, 05 Sep 2006 23:31:20 GMT--5
Server: Cherokee/0.5.4 (UNIX)
Location: /akasha/
Content-Type: text/html
Content-length: 267
Cache-Control: no-cache
Pragma: no-cache
P3P: CP=3DNOI NID CURa OUR NOR UNI


_______________________________________________
Cherokee mailing list
Cherokee0x50.org
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee
301 puzzlement
user name
2006-09-07 08:54:51
Hi Eric!

> I am probably missing something obvious again but
here's something that
> has me puzzled.  I have a CGI program that executes for
every URL
> starting with /akasha.  But if I leave off the trailing
slash, I get a
> redirect to the URL with a /.  Ideally what should
happen is it
> shouldn't matter if there's a trailing slash, it
should just invoke the
> CGI and be done with it.  normally this is not a
problem when accessing
> pages but it is causing problems for CGI.  It would
really be nice to
> not have to remember to add that trailing /
>
> what am I missing?
>
> Directory /akasha {
>     Handler cgi {
>
> GET /akasha HTTP/1.1
>
> HTTP/1.1 301 Moved Permanently
> Location: /akasha/

  That is the expected behaviour. The directory entry
specifies how
  its contents should be treated, not the entry itself.

  For example, imagine that your CGI replies with a
redirection to
  "thing.cgi?whatever=1".  In this case the
final URL will be:

    /akasha/thing.cgi?whatever=1

  however, if the server would manage the directory like its
content,
  as you are proposing, the final URL would be:

    /thing.cgi?whatever=1

-- 
Greetings, alo.
http://www.alobbs.com
_______________________________________________
Cherokee mailing list
Cherokee0x50.org
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee
301 puzzlement
user name
2006-09-07 08:54:51
Hi Eric!

> I am probably missing something obvious again but
here's something that
> has me puzzled.  I have a CGI program that executes for
every URL
> starting with /akasha.  But if I leave off the trailing
slash, I get a
> redirect to the URL with a /.  Ideally what should
happen is it
> shouldn't matter if there's a trailing slash, it
should just invoke the
> CGI and be done with it.  normally this is not a
problem when accessing
> pages but it is causing problems for CGI.  It would
really be nice to
> not have to remember to add that trailing /
>
> what am I missing?
>
> Directory /akasha {
>     Handler cgi {
>
> GET /akasha HTTP/1.1
>
> HTTP/1.1 301 Moved Permanently
> Location: /akasha/

  That is the expected behaviour. The directory entry
specifies how
  its contents should be treated, not the entry itself.

  For example, imagine that your CGI replies with a
redirection to
  "thing.cgi?whatever=1".  In this case the
final URL will be:

    /akasha/thing.cgi?whatever=1

  however, if the server would manage the directory like its
content,
  as you are proposing, the final URL would be:

    /thing.cgi?whatever=1

-- 
Greetings, alo.
http://www.alobbs.com
_______________________________________________
Cherokee mailing list
Cherokee0x50.org
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee
301 puzzlement
user name
2006-09-07 18:56:47
Alvaro Lopez Ortega wrote:
> Hi Eric!
> 
>> I am probably missing something obvious again but
here's something that
...


>   That is the expected behaviour. The directory entry
specifies how
>   its contents should be treated, not the entry itself.
> 
>   For example, imagine that your CGI replies with a
redirection to
>   "thing.cgi?whatever=1".  In this case the
final URL will be:
> 
>     /akasha/thing.cgi?whatever=1
> 
>   however, if the server would manage the directory
like its content,
>   as you are proposing, the final URL would be:
> 
>     /thing.cgi?whatever=1


okay.  I follow that.  doing a few other tests I saw how the
rewrite is 
automatically handled if the URL isn't associated with a
file but 
instead is associated with the directory.  I assume then
that if I want 
to handle the URL without a trailing /and a map to the same
URL with a 
trailing  / I'm going to need some sort of a rewrite
statement.
_______________________________________________
Cherokee mailing list
Cherokee0x50.org
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee
301 puzzlement
user name
2006-09-07 19:11:50
Eric S. Johansson wrote:

>>   That is the expected behaviour. The directory
entry specifies how
>>   its contents should be treated, not the entry
itself.
>>
>>   For example, imagine that your CGI replies with a
redirection to
>>   "thing.cgi?whatever=1".  In this case
the final URL will be:
>>
>>     /akasha/thing.cgi?whatever=1
>>
>>   however, if the server would manage the directory
like its content,
>>   as you are proposing, the final URL would be:
>>
>>     /thing.cgi?whatever=1
>
> okay.  I follow that.  doing a few other tests I saw
how the rewrite
> is automatically handled if the URL isn't associated
with a file but
> instead is associated with the directory.  I assume
then that if I
> want to handle the URL without a trailing /and a map to
the same URL
> with a trailing / I'm going to need some sort of a
rewrite
> statement.

  Yeah, a hidden rewrite rule, otherwise the result would be
the
  same.  Something like this should work:

=========
    Request "^/akasha$" {
      Handler redir {
	   Rewrite "/akasha/"
	 }
    }
=========

  Good luck!

-- 
Greetings, alo.
http://www.alobbs.com
_______________________________________________
Cherokee mailing list
Cherokee0x50.org
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee
301 puzzlement
user name
2006-09-07 18:56:47
Alvaro Lopez Ortega wrote:
> Hi Eric!
> 
>> I am probably missing something obvious again but
here's something that
...


>   That is the expected behaviour. The directory entry
specifies how
>   its contents should be treated, not the entry itself.
> 
>   For example, imagine that your CGI replies with a
redirection to
>   "thing.cgi?whatever=1".  In this case the
final URL will be:
> 
>     /akasha/thing.cgi?whatever=1
> 
>   however, if the server would manage the directory
like its content,
>   as you are proposing, the final URL would be:
> 
>     /thing.cgi?whatever=1


okay.  I follow that.  doing a few other tests I saw how the
rewrite is 
automatically handled if the URL isn't associated with a
file but 
instead is associated with the directory.  I assume then
that if I want 
to handle the URL without a trailing /and a map to the same
URL with a 
trailing  / I'm going to need some sort of a rewrite
statement.
_______________________________________________
Cherokee mailing list
Cherokee0x50.org
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee
301 puzzlement
user name
2006-09-07 19:11:50
Eric S. Johansson wrote:

>>   That is the expected behaviour. The directory
entry specifies how
>>   its contents should be treated, not the entry
itself.
>>
>>   For example, imagine that your CGI replies with a
redirection to
>>   "thing.cgi?whatever=1".  In this case
the final URL will be:
>>
>>     /akasha/thing.cgi?whatever=1
>>
>>   however, if the server would manage the directory
like its content,
>>   as you are proposing, the final URL would be:
>>
>>     /thing.cgi?whatever=1
>
> okay.  I follow that.  doing a few other tests I saw
how the rewrite
> is automatically handled if the URL isn't associated
with a file but
> instead is associated with the directory.  I assume
then that if I
> want to handle the URL without a trailing /and a map to
the same URL
> with a trailing / I'm going to need some sort of a
rewrite
> statement.

  Yeah, a hidden rewrite rule, otherwise the result would be
the
  same.  Something like this should work:

=========
    Request "^/akasha$" {
      Handler redir {
	   Rewrite "/akasha/"
	 }
    }
=========

  Good luck!

-- 
Greetings, alo.
http://www.alobbs.com
_______________________________________________
Cherokee mailing list
Cherokee0x50.org
http://www.0x50.org/cgi-bin/mailman/listinfo/cherokee
[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )