You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Riggen, Scott" <Sc...@escocorp.com> on 2014/02/07 20:12:27 UTC
[users@httpd] RE: Having issues trying to use
rewriterule,proxypass,proxyreversepass
Well. A couple of days now and still no closer to making this work.
I'm sure I am missing something obvious. Time to pour over all the apache docs line by line since I have not found anything relevant via google or bing.
Or maybe switch to another web server other than apache......
Scott
From: Riggen, Scott [mailto:Scott.Riggen@escocorp.com]
Sent: Wednesday, February 05, 2014 2:25 PM
To: users@httpd.apache.org
Subject: [users@httpd] Having issues trying to use rewriterule,proxypass,proxyreversepass
Apache info.
#apachectl -version
Server version: Apache/2.2.22 (Unix)
OS: Sles 11 64bit SP2
Modules compiled in.
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_default.c
mod_auth_basic.c
mod_filter.c
mod_log_config.c
mod_headers.c
mod_unique_id.c
mod_setenvif.c
mod_version.c
mod_proxy.c
mod_proxy_connect.c
mod_proxy_ftp.c
mod_proxy_http.c
mod_proxy_scgi.c
mod_proxy_ajp.c
mod_proxy_balancer.c
mod_ssl.c
prefork.c
http_core.c
mod_mime.c
mod_dir.c
mod_rewrite.c
mod_so.c
Using apache as a reverse proxy server in a DMZ.
I have external address.
https://myserver.domain.com setup to answer connections (and that is working fine)
I need to rewrite and proxy/reverseproxy that to an internal http server through a firewall.
Something like http://internalserver.domain.com:port#/dir/login.jspx
>From my internal network I can go straight to http://internalserver.domain.com:port#/dir/login.jspx and I get a login page but I also get back some additional stuff in the http line.
Something like http://internalserver.domain.com:port#/dir/login.jspx?_afrLoop=678802396079181&_afrWindowMode=0&_adf.ctrl-state=lunbexpzu_4
I can also start a browser on the linux server in the DMZ and go to http://internalserver.domain.com:port#/dir/login.jspx<http://internalserver.domain.com:7011/dir/login.jspx> and I get a login page so I know my firewall rules are ok.
I just cannot seem to find the correct combination of rewriterule, proxypass, proxyreversepass to make this work.
Any assistance will be appreciated.
Regards,
Scott
RE: [users@httpd] RE: Having issues trying to use
rewriterule,proxypass,proxyreversepass
Posted by "Riggen, Scott" <Sc...@escocorp.com>.
Tom,
Here is my actual 3 config lines.
RewriteRule ^/$ https://volunteermatchbu.escocorp.com/esco_vm-ViewController-context-root/faces/login.jspx [R,L]
RewriteRule ^/esco_vm-ViewController-context-root/faces/(.*) http://certsoamt.escocorp.com:7011/esco_vm-ViewController-context-root/faces/$1 [P]
ProxyPassReverse /esco_vm-ViewController-context-root/faces/ http://certsoamt.escocorp.com:7011/esco_vm-ViewController-context-root/faces/
I already have the debug log level at 9.....
I don't control the back end server but from what I can tell you cannot land on anything other than the actual login.jspx to get a login page.
I have a working reverseproxy config for another internal server but that is not an Oracle SOA server and when I duplicated this working ruleset and changed my particulars it did not work.
Here is that those configs looks like.
RewriteRule ^/$ https://iservicecert.escocorp.com/OA_HTML/AppsLocalLogin.jsp$1 [R,L]
#
RewriteRule ^/OA_HTML/(.*) http://drsswa12.escocorp.com:8018/OA_HTML/$1 [P]
ProxyPassReverse /OA_HTML/ http://drsswa12.escocorp.com:8018/OA_HTML/
At this point I'd use any config that would work.
The online samples and even the apache docs are a pin to decipher as far as I am concerned.
Scott
-----Original Message-----
From: Tom Evans [mailto:tevans.uk@googlemail.com]
Sent: Monday, February 10, 2014 8:48 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] RE: Having issues trying to use rewriterule,proxypass,proxyreversepass
On Mon, Feb 10, 2014 at 4:39 PM, Riggen, Scott <Sc...@escocorp.com> wrote:
> Tom,
>
> I put port# in to indicate that we are using a different port than standard on the inside network/server.
> In this case it is an Oracle SOA server on port 7011.
> I can assure you that none of my actual rules contains or begins with a # sign.
>
> I'm still not sure why my rewrite rules are not working and have been banging on this for a few days now.
>
> Scott
>
Two things:
1) Post actual configs. If I don't know whether what you are saying is what you are running, it is very hard to speculate what is going wrong.
2) Turn on the rewrite log at level 5 or above. Identify a request which does not redirect correctly and look at why.
Actually a few more:
"then I think I need ProxyReversePass to get traffic back to the client."
Mmm - no. ProxyPassReverse rewrites certain headers. If your backend web-app does a redirect, and the redirect doesn't work/leaves your browser somewhere funny, then your ProxyPassReverse is incorrect. If your request never makes it to your backend, then ProxyPassReverse is never coming in to play.
Proxying via rewrite rules is trickier than just using ProxyPass. Why not use ProxyPass?
Proxying to different paths is trickier than proxying to the same path. Why proxy / to /dir1/dir2/login.aspx, when you can just proxy /dir1/dir2/ to /dir1/dir2/ and use a redirect on the proxy to send people who go to / to the right location.
Make it easy, make it work, then make it work how you want. Also turn on and read the logs if you persist with rewrite.
Cheers
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] RE: Having issues trying to use rewriterule,proxypass,proxyreversepass
Posted by Tom Evans <te...@googlemail.com>.
On Mon, Feb 10, 2014 at 4:39 PM, Riggen, Scott
<Sc...@escocorp.com> wrote:
> Tom,
>
> I put port# in to indicate that we are using a different port than standard on the inside network/server.
> In this case it is an Oracle SOA server on port 7011.
> I can assure you that none of my actual rules contains or begins with a # sign.
>
> I'm still not sure why my rewrite rules are not working and have been banging on this for a few days now.
>
> Scott
>
Two things:
1) Post actual configs. If I don't know whether what you are saying is
what you are running, it is very hard to speculate what is going
wrong.
2) Turn on the rewrite log at level 5 or above. Identify a request
which does not redirect correctly and look at why.
Actually a few more:
"then I think I need ProxyReversePass to get traffic back to the client."
Mmm - no. ProxyPassReverse rewrites certain headers. If your backend
web-app does a redirect, and the redirect doesn't work/leaves your
browser somewhere funny, then your ProxyPassReverse is incorrect. If
your request never makes it to your backend, then ProxyPassReverse is
never coming in to play.
Proxying via rewrite rules is trickier than just using ProxyPass. Why
not use ProxyPass?
Proxying to different paths is trickier than proxying to the same
path. Why proxy / to /dir1/dir2/login.aspx, when you can just proxy
/dir1/dir2/ to /dir1/dir2/ and use a redirect on the proxy to send
people who go to / to the right location.
Make it easy, make it work, then make it work how you want. Also turn
on and read the logs if you persist with rewrite.
Cheers
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] RE: Having issues trying to use
rewriterule,proxypass,proxyreversepass
Posted by "Riggen, Scott" <Sc...@escocorp.com>.
Tom,
I put port# in to indicate that we are using a different port than standard on the inside network/server.
In this case it is an Oracle SOA server on port 7011.
I can assure you that none of my actual rules contains or begins with a # sign.
I'm still not sure why my rewrite rules are not working and have been banging on this for a few days now.
Scott
> i.e. https://myserver.mydomain.com/dir1/dir2/login.jspx gets proxied
> to http://internalserver.mydomain.com:port#/dir1/dir2/login.jspx
Anything after a '#' in a URL is browser state, the browser neither sends nor receives this data from a server.
It's also the comment character in httpd config files, so god knows what that rule does.
Cheers
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] RE: Having issues trying to use rewriterule,proxypass,proxyreversepass
Posted by Tom Evans <te...@googlemail.com>.
On Fri, Feb 7, 2014 at 11:04 PM, Riggen, Scott
<Sc...@escocorp.com> wrote:
> Current configuration in my vhosts file.
>
>
>
> This is not in a location or directory block. It is in the normal
> virtualhost block
>
> I want my first rewriterule setup so that a user can type in
> https://myserver.mydomain.com/ and it will rewrite that to the full URL for
> the internal server.
>
> i.e. https://myserver.mydomain.com/ becomes
> https://myserver.mydomain.com/dir1/dir2/login.jspx
>
>
>
> The second rewriterule is for proxying to the internal server through a
> firewall.
>
> i.e. https://myserver.mydomain.com/dir1/dir2/login.jspx gets proxied to
> http://internalserver.mydomain.com:port#/dir1/dir2/login.jspx
>
>
>
> then I think I need ProxyReversePass to get traffic back to the client.
>
> Here are the lines from my current config……What am I missing here ?
>
>
>
> RewriteRule ^/$ https://myserver.mydomain.com/dir1/dir2/login.jspx [R,L]
>
> RewriteRule ^/dir1/dir2/(.*)
> http://internalserver.mydomain.com:port#/dir1/dir2/$1 [P]
>
> ProxyPassReverse /dir1/dir2/
> http://internalserver.mydomain.com:port#/dir1/dir2/
Anything after a '#' in a URL is browser state, the browser neither
sends nor receives this data from a server.
It's also the comment character in httpd config files, so god knows
what that rule does.
Cheers
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] RE: Having issues trying to use
rewriterule,proxypass,proxyreversepass
Posted by "Riggen, Scott" <Sc...@escocorp.com>.
Current configuration in my vhosts file.
This is not in a location or directory block. It is in the normal virtualhost block
I want my first rewriterule setup so that a user can type in https://myserver.mydomain.com/ and it will rewrite that to the full URL for the internal server.
i.e. https://myserver.mydomain.com/ becomes https://myserver.mydomain.com/dir1/dir2/login.jspx
The second rewriterule is for proxying to the internal server through a firewall.
i.e. https://myserver.mydomain.com/dir1/dir2/login.jspx gets proxied to http://internalserver.mydomain.com:port#/dir1/dir2/login.jspx
then I think I need ProxyReversePass to get traffic back to the client.
Here are the lines from my current config......What am I missing here ?
RewriteRule ^/$ https://myserver.mydomain.com/dir1/dir2/login.jspx [R,L]
RewriteRule ^/dir1/dir2/(.*) http://internalserver.mydomain.com:port#/dir1/dir2/$1 [P]
ProxyPassReverse /dir1/dir2/ http://internalserver.mydomain.com:port#/dir1/dir2/
If it makes a difference the internal server is running Oracle SOA stack.
Again. I can go directly to the Oracle SOA server with a browser and it works fine so I know the application is providing a login page and I also know my firewall rule is good because I run a web browser on the proxy server in the DMZ and go direct to the page and I get a login.
Any help would be greatly appreciated.
Starting to get pretty frustrating........
Scott
From: Riggen, Scott [mailto:Scott.Riggen@escocorp.com]
Sent: Friday, February 07, 2014 11:12 AM
To: users@httpd.apache.org
Subject: [users@httpd] RE: Having issues trying to use rewriterule,proxypass,proxyreversepass
Well. A couple of days now and still no closer to making this work.
I'm sure I am missing something obvious. Time to pour over all the apache docs line by line since I have not found anything relevant via google or bing.
Or maybe switch to another web server other than apache......
Scott
From: Riggen, Scott [mailto:Scott.Riggen@escocorp.com]
Sent: Wednesday, February 05, 2014 2:25 PM
To: users@httpd.apache.org<ma...@httpd.apache.org>
Subject: [users@httpd] Having issues trying to use rewriterule,proxypass,proxyreversepass
Apache info.
#apachectl -version
Server version: Apache/2.2.22 (Unix)
OS: Sles 11 64bit SP2
Modules compiled in.
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_default.c
mod_auth_basic.c
mod_filter.c
mod_log_config.c
mod_headers.c
mod_unique_id.c
mod_setenvif.c
mod_version.c
mod_proxy.c
mod_proxy_connect.c
mod_proxy_ftp.c
mod_proxy_http.c
mod_proxy_scgi.c
mod_proxy_ajp.c
mod_proxy_balancer.c
mod_ssl.c
prefork.c
http_core.c
mod_mime.c
mod_dir.c
mod_rewrite.c
mod_so.c
Using apache as a reverse proxy server in a DMZ.
I have external address.
https://myserver.domain.com setup to answer connections (and that is working fine)
I need to rewrite and proxy/reverseproxy that to an internal http server through a firewall.
Something like http://internalserver.domain.com:port#/dir/login.jspx
>From my internal network I can go straight to http://internalserver.domain.com:port#/dir/login.jspx and I get a login page but I also get back some additional stuff in the http line.
Something like http://internalserver.domain.com:port#/dir/login.jspx?_afrLoop=678802396079181&_afrWindowMode=0&_adf.ctrl-state=lunbexpzu_4
I can also start a browser on the linux server in the DMZ and go to http://internalserver.domain.com:port#/dir/login.jspx<http://internalserver.domain.com:7011/dir/login.jspx> and I get a login page so I know my firewall rules are ok.
I just cannot seem to find the correct combination of rewriterule, proxypass, proxyreversepass to make this work.
Any assistance will be appreciated.
Regards,
Scott