You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marcos Mendez <ma...@gmail.com> on 2009/10/27 22:55:41 UTC
[users@httpd] mod_proxy+mod_rewrite: hiding redirection
I'm using mod_proxy/mod_rewrite to redirect requests to a specific
script which handles them. For example:
<Proxy *>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^123.123.123.123 [NC]
RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}
</Proxy>
This is working great. The question is, can I hide that redirection
(http://123.123.123.123/myscript?url=thewebsite.com) and keep the
requested url in the address bar somehow?
Regards,
Marcos
---------------------------------------------------------------------
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] mod_proxy+mod_rewrite: hiding redirection
Posted by Marcos Mendez <ma...@gmail.com>.
On Wed, Oct 28, 2009 at 8:43 AM, Krist van Besien
<kr...@gmail.com> wrote:
> On Tue, Oct 27, 2009 at 10:55 PM, Marcos Mendez <ma...@gmail.com> wrote:
>> I'm using mod_proxy/mod_rewrite to redirect requests to a specific
>> script which handles them. For example:
>>
>> <Proxy *>
>> RewriteEngine on
>> RewriteCond %{HTTP_HOST} !^123.123.123.123 [NC]
>> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}
>> </Proxy>
>>
>> This is working great. The question is, can I hide that redirection
>> (http://123.123.123.123/myscript?url=thewebsite.com) and keep the
>> requested url in the address bar somehow?
>
> Just add the [P] flag to your RewriteRule (and only the P flag...)
>
> Krist
>
>
>
>
> --
> krist.vanbesien@gmail.com
> krist@vanbesien.org
> Bremgarten b. Bern, Switzerland
> --
> A: It reverses the normal flow of conversation.
> Q: What's wrong with top-posting?
> A: Top-posting.
> Q: What's the biggest scourge on plain text email discussions?
>
> ---------------------------------------------------------------------
> 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
>
>
Still no joy. Let me post my whole proxy.conf and site.conf....
<IfModule mod_proxy.c>
ProxyRequests On
NoProxy .somedomain.com 172.16.1.29
<Proxy *>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^172.16.1.29 [NC]
RewriteRule ^(.+)$
http://172.16.1.29/script.cgi/browse?URL=%{REQUEST_URI} [P]
Order allow, deny
Allow from all
</Proxy>
ProxyVia Off
</IfModule>
I've tried changing the rewriterule flags as suggested [P,R,L], [R,L],
[P,L], [P], but I still see the redirect in the address bar. Also the
cgi script is being hosted in a virtual host on the same machine.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
AddHandler cgi-script .cgi
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options +ExecCGI
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
---------------------------------------------------------------------
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] mod_proxy+mod_rewrite: hiding redirection
Posted by Krist van Besien <kr...@gmail.com>.
On Tue, Oct 27, 2009 at 10:55 PM, Marcos Mendez <ma...@gmail.com> wrote:
> I'm using mod_proxy/mod_rewrite to redirect requests to a specific
> script which handles them. For example:
>
> <Proxy *>
> RewriteEngine on
> RewriteCond %{HTTP_HOST} !^123.123.123.123 [NC]
> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}
> </Proxy>
>
> This is working great. The question is, can I hide that redirection
> (http://123.123.123.123/myscript?url=thewebsite.com) and keep the
> requested url in the address bar somehow?
Just add the [P] flag to your RewriteRule (and only the P flag...)
Krist
--
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?
---------------------------------------------------------------------
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] mod_proxy+mod_rewrite: hiding redirection
Posted by Igor Cicimov <ic...@gmail.com>.
What if you remove the <Proxy *> handle? As it is written now I don't see
any particular need for it?
On Wed, Oct 28, 2009 at 3:09 PM, Marcos Mendez <ma...@gmail.com>wrote:
> On Tue, Oct 27, 2009 at 8:47 PM, Igor Cicimov <ic...@gmail.com> wrote:
> > Try playing with the P,R,L flags in the rewrite rule and see what happens
> :)
> > e.g.
> >
> > RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>[P,R,L]
> > or
> > RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>[R,L]
> > or
> > RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>[P,L]
> >
> > Cheers,
> >
> > Igor
> >
> > On Wed, Oct 28, 2009 at 8:55 AM, Marcos Mendez <ma...@gmail.com>
> > wrote:
> >>
> >> I'm using mod_proxy/mod_rewrite to redirect requests to a specific
> >> script which handles them. For example:
> >>
> >> <Proxy *>
> >> RewriteEngine on
> >> RewriteCond %{HTTP_HOST} !^123.123.123.123 [NC]
> >> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>
> >> </Proxy>
> >>
> >> This is working great. The question is, can I hide that redirection
> >> (http://123.123.123.123/myscript?url=thewebsite.com) and keep the
> >> requested url in the address bar somehow?
> >>
> >> Regards,
> >>
> >> Marcos
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >>
> >
> >
>
> Tried all of them. Looks the same from the browser. Maybe I'm missing
> something?
>
> ---------------------------------------------------------------------
> 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] mod_proxy+mod_rewrite: hiding redirection
Posted by Marcos Mendez <ma...@gmail.com>.
On Tue, Oct 27, 2009 at 8:47 PM, Igor Cicimov <ic...@gmail.com> wrote:
> Try playing with the P,R,L flags in the rewrite rule and see what happens :)
> e.g.
>
> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI} [P,R,L]
> or
> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI} [R,L]
> or
> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI} [P,L]
>
> Cheers,
>
> Igor
>
> On Wed, Oct 28, 2009 at 8:55 AM, Marcos Mendez <ma...@gmail.com>
> wrote:
>>
>> I'm using mod_proxy/mod_rewrite to redirect requests to a specific
>> script which handles them. For example:
>>
>> <Proxy *>
>> RewriteEngine on
>> RewriteCond %{HTTP_HOST} !^123.123.123.123 [NC]
>> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}
>> </Proxy>
>>
>> This is working great. The question is, can I hide that redirection
>> (http://123.123.123.123/myscript?url=thewebsite.com) and keep the
>> requested url in the address bar somehow?
>>
>> Regards,
>>
>> Marcos
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
>
Tried all of them. Looks the same from the browser. Maybe I'm missing something?
---------------------------------------------------------------------
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] mod_proxy+mod_rewrite: hiding redirection
Posted by Igor Cicimov <ic...@gmail.com>.
Try playing with the P,R,L flags in the rewrite rule and see what happens :)
e.g.
RewriteRule $(.+)
http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>[P,R,L]
or
RewriteRule $(.+)
http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>[R,L]
or
RewriteRule $(.+)
http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>[P,L]
Cheers,
Igor
On Wed, Oct 28, 2009 at 8:55 AM, Marcos Mendez <ma...@gmail.com>wrote:
> I'm using mod_proxy/mod_rewrite to redirect requests to a specific
> script which handles them. For example:
>
> <Proxy *>
> RewriteEngine on
> RewriteCond %{HTTP_HOST} !^123.123.123.123 [NC]
> RewriteRule $(.+) http://123.123.123.123/myscript?url=%{REQUEST_URI}<http://123.123.123.123/myscript?url=%%7BREQUEST_URI%7D>
> </Proxy>
>
> This is working great. The question is, can I hide that redirection
> (http://123.123.123.123/myscript?url=thewebsite.com) and keep the
> requested url in the address bar somehow?
>
> Regards,
>
> Marcos
>
> ---------------------------------------------------------------------
> 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
>
>