You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Anastasios Angelidis <vo...@videotron.ca> on 2005/04/18 15:52:28 UTC

[users@httpd] Reverse Proxy, Spelling And Rewrite.

Hi, am trying to use mod_proxy, mod_spelling and mod rewrite to create 
my reverse proxy...

I have mod_proxy working as follows...

<VirtualHost *:80>
    ProxyRequests off

    <Proxy *>
       Order deny,allow
       Allow from all
    </Proxy>

    ProxyPass /somewhere/ http://myinternalserver.com/somewhere/
    ProxyPassReverse /somewhere/ http://myinternalserver.com/somewhere/

</VirtualHost>

Now I would like to add spell checking to make my url's caseinsensitive.

So I did...

<VirtualHost *:80>
    CheckSplling on
    ProxyRequests off

    <Proxy *>
       Order deny,allow
       Allow from all
    </Proxy>

    ProxyPass /somewhere/ http://myinternalserver.com/somewhere/
    ProxyPassReverse /somewhere/ http://myinternalserver.com/somewhere/

</VirtualHost>

But it doesn't seem to work...




---------------------------------------------------------------------
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] Reverse Proxy and Rewrite.

Posted by Richard Paladino <pa...@iii.com>.
Hi Users,

I would like to 2nd the request that Chitta notes below.  Here is my 
specific situation:

I need to be able to accommodate a back-end server with reverse proxy 
rewrite rules.  My back-end servers run on multiple ports and the URLs are 
widely variable.

I have created rewrite rules to cover most of the "normal" activity:

RewriteCond %{HTTP_HOST} 
^([0-9]{1,5}-[.a-zA-Z0-9-]*\.)?frontend\.server\.com(:[0-9]+)?$
RewriteRule ^/(.*) http://%1backend.server.com%2/$1 [P,L]


My problem is that the backend server redirects to SSL ports at various 
times.  I have a list of URLs that I need to catch to do this, but I can't 
find any way to transfer the connection internally in Apache to another 
virtual host (an SSL port) when the backend server sends one of its redirects.

Here is an example URL:

http://backend.server.com/verification
...redirects the user to:
https://backend.server.com/verification/~S8

I have successfully created an SSL virtual host that itself contains all 
the rewrite rules noted above, it's this explicit redirect that I have no 
idea how to handle.  What happens at redirect is that I "pop out of" the 
reverse proxy connection and end up at the backend server.

If a creative User can help with this, you will have earned my un-dying 
respect and gratitude...

Thanks in advance,
Richard


At 07:03 AM 4/18/2005, Chittaranjan Mandal wrote:
>Reverse proxy is so useful.
>
>It would be nice to have a complete example covering
>+ main web server reverse proxying HTTP requests to internal web servers
>+ main web server reverse proxying HTTPS requests to internal web servers
>+ Dealing with the situation when the internal web server rewrites a
>    HTTP request to a HTTPS request
>+ Dealing with the situation when the internal web server rewrites a
>    HTTPS request to a HTTP request
>
>-Chitta
>
>---------------------------------------------------------------------
>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] Reverse Proxy, Spelling And Rewrite.

Posted by Chittaranjan Mandal <Ch...@iitkgp.ac.in>.
Reverse proxy is so useful.

It would be nice to have a complete example covering
+ main web server reverse proxying HTTP requests to internal web servers
+ main web server reverse proxying HTTPS requests to internal web servers
+ Dealing with the situation when the internal web server rewrites a
   HTTP request to a HTTPS request
+ Dealing with the situation when the internal web server rewrites a
   HTTPS request to a HTTP request

-Chitta

---------------------------------------------------------------------
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] Reverse Proxy, Spelling And Rewrite.

Posted by Joshua Slive <js...@gmail.com>.
On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
> Ok cool I have it working as follows. Is there anything worng with this?
> 
> #Setup VH for SSL
> <VirtualHost *:443>
> 
>     SSLEngine on
>     ProxyRequests off
>     RewriteEngine on
> 
>     # Handle trailing slash
>     RewriteRule ^/somewhere$ /somewhere/ [NC,R]
> 
>     # Create proxy request
>     RewriteRule ^/somewhere/(.*)$ http://internalserver.com/somwhere/$1
> [NC,P]
>     ProxyPassReverese /somewhere/ http://internalserver.com/somwhere/
> 
>     # Rest of SSL stuff here...
> 
> </VirtualHost>

It looks right to me.

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] Reverse Proxy, Spelling And Rewrite.

Posted by Anastasios Angelidis <vo...@videotron.ca>.
Ok cool I have it working as follows. Is there anything worng with this?

#Setup VH for SSL
<VirtualHost *:443>

    SSLEngine on
    ProxyRequests off
    RewriteEngine on

    # Handle trailing slash
    RewriteRule ^/somewhere$ /somewhere/ [NC,R]

    # Create proxy request
    RewriteRule ^/somewhere/(.*)$ http://internalserver.com/somwhere/$1 
[NC,P]
    ProxyPassReverese /somewhere/ http://internalserver.com/somwhere/

    # Rest of SSL stuff here...

</VirtualHost>

Thanks

Anastasios Angelidis wrote:

> Thanks
>
> So to be clear...
>
> http://frontserver.com/somewhere or http://frontserver.com/SOMEWHERE 
> or http://frontserver.com/SomeWhere
> to proxy to
> http://backserver.com/somewhere
>
>
> Joshua Slive wrote:
>
>> On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
>>  
>>
>>> Well that sux because with Pound /SOMEWHERE , /somewhere , /someWHERE
>>> etc... Is all the same.
>>>   
>>
>>
>> If it is a part of the URL that is resolved at the proxy, then you can
>> do that -- as I explained earlier, use the NC and P options of
>> RewriteRule.  If it is part of the URL resolved on the back-end, then
>> it is impossible.
>>
>>  
>>
>>> As for trailing / can you point me to the right doc? Thanks
>>>   
>>
>>
>> There are some examples in mod_rewrite's RewriteGuide.
>>
>> 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
>
>


---------------------------------------------------------------------
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] Reverse Proxy, Spelling And Rewrite.

Posted by Anastasios Angelidis <vo...@videotron.ca>.
Thanks

So to be clear...

http://frontserver.com/somewhere or http://frontserver.com/SOMEWHERE or 
http://frontserver.com/SomeWhere
to proxy to
http://backserver.com/somewhere


Joshua Slive wrote:

>On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
>  
>
>>Well that sux because with Pound /SOMEWHERE , /somewhere , /someWHERE
>>etc... Is all the same.
>>    
>>
>
>If it is a part of the URL that is resolved at the proxy, then you can
>do that -- as I explained earlier, use the NC and P options of
>RewriteRule.  If it is part of the URL resolved on the back-end, then
>it is impossible.
>
>  
>
>>As for trailing / can you point me to the right doc? Thanks
>>    
>>
>
>There are some examples in mod_rewrite's RewriteGuide.
>
>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] Reverse Proxy, Spelling And Rewrite.

Posted by Joshua Slive <js...@gmail.com>.
On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
> Well that sux because with Pound /SOMEWHERE , /somewhere , /someWHERE
> etc... Is all the same.

If it is a part of the URL that is resolved at the proxy, then you can
do that -- as I explained earlier, use the NC and P options of
RewriteRule.  If it is part of the URL resolved on the back-end, then
it is impossible.

> 
> As for trailing / can you point me to the right doc? Thanks

There are some examples in mod_rewrite's RewriteGuide.

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] Reverse Proxy, Spelling And Rewrite.

Posted by Anastasios Angelidis <vo...@videotron.ca>.
Well that sux because with Pound /SOMEWHERE , /somewhere , /someWHERE 
etc... Is all the same.

As for trailing / can you point me to the right doc? Thanks


Joshua Slive wrote:

>On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
>  
>
>>What I would like to solve is...
>>
>>1- Case Insensitive URLs
>>    
>>
>
>As I said, this is not even theoretically possible to do at the proxy.
> It is the back-end that determines what is an acceptable URL.
>
>  
>
>>2- Add trailling / if missing.
>>
>>Bassically I want to take care of the problems where a person will type
>>in the URL. Thats why ProxyPassReverse isn't ass important, because it
>>comes from the server not the user.
>>    
>>
>
>In general, it is ProxyPassReverse that makes sure trailing-slash
>redirects work correctly.  You could do it manually at the proxy, but
>it would be more complicated.
>
>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] Reverse Proxy, Spelling And Rewrite.

Posted by Joshua Slive <js...@gmail.com>.
On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
> What I would like to solve is...
> 
> 1- Case Insensitive URLs

As I said, this is not even theoretically possible to do at the proxy.
 It is the back-end that determines what is an acceptable URL.

> 2- Add trailling / if missing.
> 
> Bassically I want to take care of the problems where a person will type
> in the URL. Thats why ProxyPassReverse isn't ass important, because it
> comes from the server not the user.

In general, it is ProxyPassReverse that makes sure trailing-slash
redirects work correctly.  You could do it manually at the proxy, but
it would be more complicated.

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] Reverse Proxy, Spelling And Rewrite.

Posted by Anastasios Angelidis <vo...@videotron.ca>.
What I would like to solve is...

1- Case Insensitive URLs
2- Add trailling / if missing.

Bassically I want to take care of the problems where a person will type 
in the URL. Thats why ProxyPassReverse isn't ass important, because it 
comes from the server not the user.

Joshua Slive wrote:

>On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
>  
>
>>I see...
>>
>>Well am also testing Pound and Pound takes care of these issues... Thing
>>is... Pound is not as proven as Apache or is it? :D
>>    
>>
>
>You have never really described what issues you want taken care of. 
>As I said, having a reverse proxy make URLs case sensitive is not, in
>general, technically possible.
>
>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] Reverse Proxy, Spelling And Rewrite.

Posted by Joshua Slive <js...@gmail.com>.
On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
> I see...
> 
> Well am also testing Pound and Pound takes care of these issues... Thing
> is... Pound is not as proven as Apache or is it? :D

You have never really described what issues you want taken care of. 
As I said, having a reverse proxy make URLs case sensitive is not, in
general, technically possible.

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] Reverse Proxy, Spelling And Rewrite.

Posted by Anastasios Angelidis <vo...@videotron.ca>.
I see...

Well am also testing Pound and Pound takes care of these issues... Thing 
is... Pound is not as proven as Apache or is it? :D

Case insensitive URLs, trailing slashes and what not...

As for ProxyPassReverse doen't matter if it's case sensitive or not. The 
bigest problem is when someone types in the URL.

Which brings me to rewrite, I went through the rewrite guide, which 
shows most use cases like the trailing slash problem. But i ran into 
some issues...

When I have some time I will post my config for that...

Thanks

Joshua Slive wrote:

>On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
>  
>
>>Now I would like to add spell checking to make my url's caseinsensitive.
>>
>>So I did...
>>
>><VirtualHost *:80>
>>    CheckSplling on
>>    ProxyRequests off
>>
>>    <Proxy *>
>>       Order deny,allow
>>       Allow from all
>>    </Proxy>
>>
>>    ProxyPass /somewhere/ http://myinternalserver.com/somewhere/
>>    ProxyPassReverse /somewhere/ http://myinternalserver.com/somewhere/
>>
>></VirtualHost>
>>
>>But it doesn't seem to work...
>>    
>>
>
>And it won't.  mod_spelling only corrects filesystem access.  What you
>want isn't even theoretically possible, since the reverse proxy
>doesn't have any idea about the correct case of the URLs.
>
>So what exactly are you trying to do?  If you just want to make
>/somewhere/ case insensitive, then you can use RewriteRule with the P
>and NC flags (although the ProxyPassReverse part would still be case
>sensitive).
>
>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] Reverse Proxy, Spelling And Rewrite.

Posted by Joshua Slive <js...@gmail.com>.
On 4/18/05, Anastasios Angelidis <vo...@videotron.ca> wrote:
> 
> Now I would like to add spell checking to make my url's caseinsensitive.
> 
> So I did...
> 
> <VirtualHost *:80>
>     CheckSplling on
>     ProxyRequests off
> 
>     <Proxy *>
>        Order deny,allow
>        Allow from all
>     </Proxy>
> 
>     ProxyPass /somewhere/ http://myinternalserver.com/somewhere/
>     ProxyPassReverse /somewhere/ http://myinternalserver.com/somewhere/
> 
> </VirtualHost>
> 
> But it doesn't seem to work...

And it won't.  mod_spelling only corrects filesystem access.  What you
want isn't even theoretically possible, since the reverse proxy
doesn't have any idea about the correct case of the URLs.

So what exactly are you trying to do?  If you just want to make
/somewhere/ case insensitive, then you can use RewriteRule with the P
and NC flags (although the ProxyPassReverse part would still be case
sensitive).

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