LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-12-2015, 01:48 AM   #1
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Rep: Reputation: 1
reverse proxy in apache


i am using centos 5.3 with httpd server2.2.3 i rewrite some rule as below in httpd.conf
Rewrite rules for internal applications

ProxyPass /dotproject/ http://192.16.1.xx:24000/dotproject/
ProxyPass /dotproject http://192.16.1.xx:24000/dotproject/
ProxyPassReverse /dotproject/ http://192.16.1.xx:24000/dotproject/
ProxyPassReverse /dotproject http://192.16.1.xx:24000/dotproject/
RewriteRule ^.*dotproject$ http://40.65.10.85/dotproject/ [R]
where 40.65.10.85 is static ip from isp it work properly when i access http://40.65.10.85/dotproject/ it redirect properly and working fine .
i installed another application which using tomcat as application server i rewrite rule as
ProxyPass /tomcat http://192.16.1.xx:8080
ProxyPassReverse /tomcat http://192.16.1.xx:8080
ProxyPass /hello/ http://192.16.1.xx:8080
ProxyPass /hello http://192.16.1.xx:8080
ProxyPassReverse /hello/ http://192.16.1.xx:8080
ProxyPassReverse /hello http://192.16.1.xx:8080
RewriteRule ^.*hello$ http://40.65.10.85/hello/ [R]

it is not showing proper login page and in httpd error log shows error as error] [client 40.65.10.85] File does not exist: /var/www/html/login.jsp, referer: http://40.65.10.85/hello
 
Old 01-12-2015, 05:55 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
Blog Entries: 1

Rep: Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073
Quote:
<snip>
ProxyPass /hello/ http://192.16.1.xx:8080
ProxyPass /hello http://192.16.1.xx:8080
ProxyPassReverse /hello/ http://192.16.1.xx:8080
ProxyPassReverse /hello http://192.16.1.xx:8080
RewriteRule ^.*hello$ http://40.65.10.85/hello/ [R]
The trailing slash in important in the proxied URLs, so in your case you should use:
Code:
ProxyPass /hello/ http://192.16.1.xx:8080/
ProxyPassReverse /hello/ http://192.16.1.xx:8080/
Note that you don't need to use both URLs (with and without trailing slash), you could just use:
Code:
ProxyPass /tomcat http://192.16.1.xx:8080
ProxyPassReverse /tomcat http://192.16.1.xx:8080
ProxyPass /hello http://192.16.1.xx:8080
ProxyPassReverse /hello http://192.16.1.xx:8080
RewriteRule ^.*hello$ http://40.65.10.85/hello [R]
Regards
 
Old 01-12-2015, 07:04 AM   #3
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
Thanks guru

it is now redirect to the server but on display it not shows proper image login windows etc the httpd error log shows error as
[client 40.65.10.85] File does not exist: /var/www/html/login.jsp, referer: http://40.65.10.85/hello
 
Old 01-12-2015, 09:33 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
Blog Entries: 1

Rep: Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073
Quote:
it is now redirect to the server but on display it not shows proper image login windows etc the httpd error log shows error as
[client 40.65.10.85] File does not exist: /var/www/html/login.jsp, referer: http://40.65.10.85/hello
Huh, I don't think you need both reverse proxy and the RewriteRule. You should use one backp-end server (either 192.16.1.xx:8080 or 40.65.10.85) for the same URI.
Anyways you may also try to add the following and see if it helps
Code:
ProxyRequests Off
ProxyPreserveHost On
 
Old 01-13-2015, 05:16 AM   #5
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
after adding ProxyRequests Off, ProxyPreserveHost On shows requested url not found on server
 
Old 01-13-2015, 09:15 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
Blog Entries: 1

Rep: Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073Reputation: 2073
Quote:
Originally Posted by amartlk View Post
after adding ProxyRequests Off, ProxyPreserveHost On shows requested url not found on server
Without more info, I can only guess that this error comes from apache. If that's the case, then apache does not work as a reverse proxy
Check the apache and your app's (that's running on tomcat) logs and see if apache forwards requests to tomcat and who's giving that error
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nginx Reverse proxy on a internal apache reverse server ITiger Linux - Software 0 04-25-2014 08:44 AM
apache reverse proxy chris9 Linux - Server 1 04-05-2012 09:41 AM
reverse proxy with apache 2 bootiack Linux - Software 1 08-09-2005 07:47 PM
apache reverse proxy wildbob Linux - Networking 8 10-15-2003 01:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration