alias - rewrite - proxy, which feature fits this

This is a discussion on alias - rewrite - proxy, which feature fits this within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi group, thanks in advantage for your help! I want my apache 2.2 on windows to perform the following: ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-04-2006
info2@eb7.de
 
Posts: n/a
Default alias - rewrite - proxy, which feature fits this

Hi group,
thanks in advantage for your help!

I want my apache 2.2 on windows to perform the following:
The incoming request should look like :

http://myserver.de/action/returnfile.ext

and what apache should perform is the following:

http://myserver.de/cgi-bin/action.pl?returnfile.ext

without sending a redirect back to the client, because in case of a
download the client then tries to save a "action.pl" instead of a
"returnfile.ext"

I dont think a proxy is the right thing to do because its on my own
machine.
It seems that a ScriptAlias is the thing I want but I cant't handle the
querystring and the feature to append a querystring is only available
for proxying.

Any Idea?
best regards
hatti77

  #2 (permalink)  
Old 12-04-2006
shimmyshack
 
Posts: n/a
Default Re: alias - rewrite - proxy, which feature fits this


info2@eb7.de wrote:
> Hi group,
> thanks in advantage for your help!
>
> I want my apache 2.2 on windows to perform the following:
> The incoming request should look like :
>
> http://myserver.de/action/returnfile.ext
>
> and what apache should perform is the following:
>
> http://myserver.de/cgi-bin/action.pl?returnfile.ext
>
> without sending a redirect back to the client, because in case of a
> download the client then tries to save a "action.pl" instead of a
> "returnfile.ext"
>
> I dont think a proxy is the right thing to do because its on my own
> machine.
> It seems that a ScriptAlias is the thing I want but I cant't handle the
> querystring and the feature to append a querystring is only available
> for proxying.
>
> Any Idea?
> best regards
> hatti77



RewriteEngine On
RewriteRule /([a-z]+)/(.*) /cgi-bin/$1.pl?$2 [L]


this will redirect all requests to anything of the form

/lowercaseword/anythingafterthis.ext

to

/cgi-bin/lowercaseword.pl?anythingafterthis.ext

just shove it in a directory block as per instructions on apache docs
for rewrites, or (less good) in an .htaccess file

  #3 (permalink)  
Old 12-04-2006
HansH
 
Posts: n/a
Default Re: alias - rewrite - proxy, which feature fits this

<info2@eb7.de> schreef in bericht
news:1165191016.928456.125250@n67g2000cwd.googlegr oups.com...
> The incoming request should look like :
> http://myserver.de/action/returnfile.ext
> and what apache should perform is the following:
> http://myserver.de/cgi-bin/action.pl?returnfile.ext


> without sending a redirect back to the client,

Try these untested lines in your Apache's config
RewriteEngine On
Rewriterule ^/action/(.*) /cgi-bin/action.pl?$1 [L,PT]

I'ld prefer to name the new query param to easier allow more
to be added
Rewriterule ^/action/(.*) /cgi-bin/action.pl?f=$1 [L,PT,QSA]

Be aware the file names MUST NOT contain any of these
characters: ? = & ;

By handling files of any extention your script may have to do
quite some extra work like setting content-type for any type.
More common is to only divert to a script .html urls, or requests
for .jpg-s to be watermarked.

> It seems that a ScriptAlias is the thing I want but I cant't handle the
> querystring

Although it is common to have
ScriptAlias /cgi-bin/ /parent of your document root/cgi-bin/
I do not see how to use it to fullfill your demand.
It just assigns a folder to have ONLY executable [script] files
Perl files located here should start -but for the leading spaces-
#!<path to>/perl.exe

If you plan to host the same script on linux set the first line to the needs
of linux
and set or modify the ScriptInterpreterSource directive in your config
http://httpd.apache.org/docs/2.0/mod...erpretersource

> and the feature to append a querystring is only available
> for proxying.

In the above rewriterule 'QSA': Query String Append

HansH


  #4 (permalink)  
Old 12-05-2006
info2@eb7.de
 
Posts: n/a
Default Re: alias - rewrite - proxy, which feature fits this


HansH schrieb:

> Rewriterule ^/action/(.*) /cgi-bin/action.pl?$1 [L,PT]


.... perfect!, Thanks!

>
> I'ld prefer to name the new query param to easier allow more
> to be added
> Rewriterule ^/action/(.*) /cgi-bin/action.pl?f=$1 [L,PT,QSA]


to be honest, I'm using vbs, not perl and this can handle only one parm
;-)

greetings,
Hatti77

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:46 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0