You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Paula Nousiainen <pa...@technia.com> on 2005/04/21 14:46:47 UTC
[users@httpd] Question about Apache RewriteCond Syntax on Proxy Configuration
Hi,
How could I make my Apache static content proxy to understand specified
file names ?
I have a global system with users in US Madison and in Finland Helsinki.
Helsinki is the main site and Madison users are using remotely DB located
in Helsinki.
User at Madison connects to application through Apache 7003 port:
http://sun-MADISON:7003/ematrix_xml/WebClient/eMatrixAppletDownloadXML-MDS.jsp
Plan is to forward all other request to main web server at Helsini except
applets mentioned in first RewriteCond
and static files defined in second RewriteCond:
-------------------------------------------------------------------------
ProxyPassReverse / http://sun-MADISON:7003/
RewriteEngine On
RewriteCond %{REQUEST_URI}
!.*(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab)$
[OR]
RewriteCond %{REQUEST_URI}
!.*\.(jpg|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
RewriteRule ^/(.*) http://sun-MADISON:7003/$1 [P]
--------------------------------------------------------------------
Please, help me to find the reason why this is not working as excepted ?
If I specify jars and cabs inside the static files list, then needed jars
& cabs are loaded OK locally from US Madison server.
RewriteCond %{REQUEST_URI}
!.*\.(jpg|jar|cab|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
br,
Paula
Re: [users@httpd] Question about Apache RewriteCond Syntax on Proxy Configuration
Posted by Joshua Slive <js...@gmail.com>.
On 4/27/05, Paula Nousiainen <pa...@technia.com> wrote:
> ProxyPassReverse / http://FINLAND-WEB-SERVER:7003/
> RewriteEngine On
> RewriteLog "/usr/local/apache2-2.0.52/logs/rewrite.log"
> RewriteLogLevel 9
> RewriteCond %{REQUEST_URI}
> !.*(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab)$
> RewriteRule ^/(.*) http://FINLAND-WEB-SERVER:7003/$1 [P]
> -------------------------------------------------------------------------------------
>
> When I start my application from
> http://USA-APACHE-SERVER:7003/ematrix_xml/WebClient/XX.jsp
>
> jars and cabs, that I would like to be read from local Apache .../htdocs
> directory are read from Finland, not from USA as I would like them to be
> read.
>
> rewrite.log has following information:
> MY-LAPTOP - - [27/Apr/2005:08:44:55 +0200]
> [APACHE-SERVER/sid#9f028][rid#1589f8/initial] (4)
> RewriteCond:
> input='/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab'
> pattern='!.*(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab)$'
> => matched
Your problem from the beginning has been a regex that doesn't match
the files you are trying to exclude. ***It still doesn't match!***
There is nothing in that RewriteCond that matches that particular
filename. I'm not sure how many different ways I can say that.
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] Question about Apache RewriteCond Syntax on Proxy
Configuration
Posted by Paula Nousiainen <pa...@technia.com>.
Thank You Joshua for Your comments & instructions, I try to be more
specific.
I want to read a group of files (e.g. eMatrixAppletDownload.cab) from
local Apache server at USA,
and redirect everything else to Finland main web & DB server (simplified
example of my case).
I have following configuration:
------------------------------------------------------------------------------------
ProxyPassReverse / http://FINLAND-WEB-SERVER:7003/
RewriteEngine On
RewriteLog "/usr/local/apache2-2.0.52/logs/rewrite.log"
RewriteLogLevel 9
RewriteCond %{REQUEST_URI}
!.*(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab)$
RewriteRule ^/(.*) http://FINLAND-WEB-SERVER:7003/$1 [P]
-------------------------------------------------------------------------------------
When I start my application from
http://USA-APACHE-SERVER:7003/ematrix_xml/WebClient/XX.jsp
jars and cabs, that I would like to be read from local Apache .../htdocs
directory are read from Finland, not from USA as I would like them to be
read.
rewrite.log has following information:
MY-LAPTOP - - [27/Apr/2005:08:44:55 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f8/initial] (2) init rewrite engine with
requested uri /ematrix_xml/WebClient/java/classes/
eMatrixAppletDownloadXML.cab
MY-LAPTOP - - [27/Apr/2005:08:44:55 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f8/initial] (3) applying pattern
'^/(.*)' to uri
'/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab'
MY-LAPTOP - - [27/Apr/2005:08:44:55 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f8/initial] (4) RewriteCond:
input='/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab'
pattern='!.*(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab)$'
=> matched
MY-LAPTOP - - [27/Apr/2005:08:44:55 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f8/initial] (2) rewrite
/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab ->
http://FINLAND-WEB-SERVER:7003/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab
MY-LAPTOP - - [27/Apr/2005:08:44:55 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f8/initial] (2) forcing proxy-throughput
with
http://FINLAND-WEB-SERVER:7003/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab
MY-LAPTOP - - [27/Apr/2005:08:44:55 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f8/initial] (1) go-ahead with proxy
request
proxy:http://FINLAND-WEB-SERVER:7003/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab
[OK]
-----------------------------------------
With
RewriteCond %{REQUEST_URI} !.*\.(jpg|jar|cab
|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
I have the outcome I want, but I can not use this *.jar & *.cab with other
jsp pages on my applications:
MY-LAPTOP - - [27/Apr/2005:09:21:36 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f0/initial] (2) init rewrite engine with
requested uri
/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab
MY-LAPTOP - - [27/Apr/2005:09:21:36 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f0/initial] (3) applying pattern
'^/(.*)' to uri
'/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab'
MY-LAPTOP - - [27/Apr/2005:09:21:36 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f0/initial] (4) RewriteCond:
input='/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab'
pattern='!.*\.(jpg|jar|cab|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$' =>
not-matched
MY-LAPTOP - - [27/Apr/2005:09:21:36 +0200]
[APACHE-SERVER/sid#9f028][rid#1589f0/initial] (1) pass through
/ematrix_xml/WebClient/java/classes/eMatrixAppletDownloadXML.cab
---------------------------------------------------------------------------------------------------------------------------
Could You please help me to write a living example
of how should I write my RewriteCond & RewriteRule syntax to exclude only
the group of files
and redirect others to main web server ?
br,
Paula
Joshua Slive <js...@gmail.com>
25/04/2005 16:29
Please respond to
users@httpd.apache.org
To
users@httpd.apache.org
cc
Subject
Re: [users@httpd] Question about Apache RewriteCond Syntax on Proxy
Configuration
On 4/25/05, Paula Nousiainen <pa...@technia.com> wrote:
> I tried following, which is not working:
Never say something like that on a technical mailing list.
Say exactly what you did, exactly what the outcome was, and exactly
what you want the outcome to be.
>
> ProxyPassReverse / http://sun-MADISON:7003/
> RewriteEngine On
> RewriteLog "/usr/local/apache2-2.0.52/logs/rewrite.log"
> RewriteLogLevel 9
> RewriteCond %{REQUEST_URI}
>
!.*\.(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab|Matrix.class|jpg|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
> RewriteRule ^/(.*) http://sun-MADISON:7003/$1 [P]
You are excluding files with names like
".eMatrixAppletDownloadXML.jar". I don't think you really want that
leading dot. Try fixing your regex.
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] Question about Apache RewriteCond Syntax on Proxy Configuration
Posted by Joshua Slive <js...@gmail.com>.
On 4/25/05, Paula Nousiainen <pa...@technia.com> wrote:
> I tried following, which is not working:
Never say something like that on a technical mailing list.
Say exactly what you did, exactly what the outcome was, and exactly
what you want the outcome to be.
>
> ProxyPassReverse / http://sun-MADISON:7003/
> RewriteEngine On
> RewriteLog "/usr/local/apache2-2.0.52/logs/rewrite.log"
> RewriteLogLevel 9
> RewriteCond %{REQUEST_URI}
> !.*\.(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab|Matrix.class|jpg|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
> RewriteRule ^/(.*) http://sun-MADISON:7003/$1 [P]
You are excluding files with names like
".eMatrixAppletDownloadXML.jar". I don't think you really want that
leading dot. Try fixing your regex.
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] Question about Apache RewriteCond Syntax on Proxy
Configuration
Posted by Paula Nousiainen <pa...@technia.com>.
Thank You Joshua for commenting my proxy settings.
>> Exactly what types of request do you want to go to what place?
My goal for this set up is to
1) run jsp pages from the main web server Helsinki,
where is the application process, which communicates with Oracle database.
2) From Madison Apache Proxy site, I would like to use files
- eMatrixAppletDownloadXML.jar
- SwingDownload.jar
- eMatrixAppletDownload.cab
- SwingDownload.cab
- Matrix.class
- all files ending with jpg, gif, pdf, png, zip, tgz, gz, html, htm, css
and js
Everything else, that is NOT specified above, I want to use from Helsinki
Main web server.
What would be the correct syntax ?
I tried following, which is not working:
ProxyPassReverse / http://sun-MADISON:7003/
RewriteEngine On
RewriteLog "/usr/local/apache2-2.0.52/logs/rewrite.log"
RewriteLogLevel 9
RewriteCond %{REQUEST_URI}
!.*\.(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab|Matrix.class|jpg|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
RewriteRule ^/(.*) http://sun-MADISON:7003/$1 [P]
Attached is the rewrite.log.
br,
Paula
Joshua Slive <js...@gmail.com>
21/04/2005 16:10
Please respond to
users@httpd.apache.org
To
users@httpd.apache.org
cc
Subject
Re: [users@httpd] Question about Apache RewriteCond Syntax on Proxy
Configuration
On 4/21/05, Paula Nousiainen <pa...@technia.com> wrote:
>
> Hi,
> How could I make my Apache static content proxy to understand specified
file
> names ?
>
> I have a global system with users in US Madison and in Finland
Helsinki.
> Helsinki is the main site and Madison users are using remotely DB
located in
> Helsinki.
>
> User at Madison connects to application through Apache 7003 port:
>
http://sun-MADISON:7003/ematrix_xml/WebClient/eMatrixAppletDownloadXML-MDS.jsp
>
> Plan is to forward all other request to main web server at Helsini
except
> applets mentioned in first RewriteCond
> and static files defined in second RewriteCond:
>
>
-------------------------------------------------------------------------
> ProxyPassReverse / http://sun-MADISON:7003/
> RewriteEngine On
> RewriteCond %{REQUEST_URI}
>
!.*(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab)$
> [OR]
> RewriteCond %{REQUEST_URI}
> !.*\.(jpg|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
> RewriteRule ^/(.*) http://sun-MADISON:7003/$1 [P]
> --------------------------------------------------------------------
>
> Please, help me to find the reason why this is not working as excepted ?
Well, your problem is not clearly specified. Exactly what types of
request do you want to go to what place? Obviously the above
RewriteConds are bad: Any request will match either one or the other.
If what you want to do is exclude all those jars and other extensions
from the proxy,then simply remove the [OR] to get the proper logic.
In general, you should always use the RewriteLog to help debug
mod_rewrite problems.
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] Question about Apache RewriteCond Syntax on Proxy Configuration
Posted by Joshua Slive <js...@gmail.com>.
On 4/21/05, Paula Nousiainen <pa...@technia.com> wrote:
>
> Hi,
> How could I make my Apache static content proxy to understand specified file
> names ?
>
> I have a global system with users in US Madison and in Finland Helsinki.
> Helsinki is the main site and Madison users are using remotely DB located in
> Helsinki.
>
> User at Madison connects to application through Apache 7003 port:
> http://sun-MADISON:7003/ematrix_xml/WebClient/eMatrixAppletDownloadXML-MDS.jsp
>
> Plan is to forward all other request to main web server at Helsini except
> applets mentioned in first RewriteCond
> and static files defined in second RewriteCond:
>
> -------------------------------------------------------------------------
> ProxyPassReverse / http://sun-MADISON:7003/
> RewriteEngine On
> RewriteCond %{REQUEST_URI}
> !.*(eMatrixAppletDownloadXML.jar|SwingDownload.jar|eMatrixAppletDownload.cab|SwingDownload.cab)$
> [OR]
> RewriteCond %{REQUEST_URI}
> !.*\.(jpg|gif|pdf|png|zip|tgz|gz|html|htm|css|js)$
> RewriteRule ^/(.*) http://sun-MADISON:7003/$1 [P]
> --------------------------------------------------------------------
>
> Please, help me to find the reason why this is not working as excepted ?
Well, your problem is not clearly specified. Exactly what types of
request do you want to go to what place? Obviously the above
RewriteConds are bad: Any request will match either one or the other.
If what you want to do is exclude all those jars and other extensions
from the proxy,then simply remove the [OR] to get the proper logic.
In general, you should always use the RewriteLog to help debug
mod_rewrite problems.
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