Solved

how to get Apache to use backend Jboss website

Posted on 2013-06-11
21
558 Views
Last Modified: 2013-10-06
To clarfy the question:
We need the URL http://campaigns.dns.co.za to link to http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp which runs in JBoss.7.1.1.Final.
We want a client to click on http://campaigns.dns.co.za and it connect to the URL
http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp, which is difficult for a client to remember.

Based on a suggestion from ahoffmann we tried the following in our http.conf

<VirtualHost xxx.xxx.xxx.xxx:80>
  ServerName campaigns.dns.co.za
  DirectoryIndex Main.jsp index.html index.htm index.jsp index.php index.html.var
  ErrorLog logs/campaignmanager_error_log
  CustomLog logs/campaignmanager_access_log common
  RewriteRule ^/?campaig(n|ns|nmanager)/* http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp [PT]
  ProxyPreserveHost On
  ProxyPass / http://xxx.xxx.xxx.xxx:8080/USSD
  ProxyPassReverse / http://xxx.xxx.xxx.xxx:8080/USSD
</VirtualHost>

When we typed http://campaigns.dns.co.za it did not work and we got:
HTTP Status 404 - /USSDUSSD/
type Status report
message /USSDUSSD/
description The requested resource (/USSDUSSD/) is not available.
JBoss Web/7.0.13.Final

From the logs campaignmanager_error_log we got:
[Sun May 26 20:44:08 2013] [warn] [client 188.240.35.66] proxy: no HTTP 0.9 request (with no host line) on incoming request and preserve host set forcing hostname to be campaigns.dns.co.za for uri /

From the logs campaignmanager_access_log we got:
105.228.83.70 - - [26/May/2013:20:57:31 +0200] "GET / HTTP/1.1" 302 -
105.228.83.70 - - [26/May/2013:20:57:31 +0200] "GET /USSD/ HTTP/1.1" 404 986
105.228.83.70 - - [26/May/2013:20:57:32 +0200] "GET /USSD/ HTTP/1.1" 404 986
105.228.83.70 - - [26/May/2013:20:57:48 +0200] "GET / HTTP/1.1" 302 -
105.228.83.70 - - [26/May/2013:20:57:48 +0200] "GET /USSD/ HTTP/1.1" 404 986
105.228.83.70 - - [26/May/2013:20:57:48 +0200] "GET /favicon.ico HTTP/1.1" 404 1004

We are closer than before as http://campaigns.dns.co.za:8080/USSD/Main.jsp links to http://41.xxx.xxx.xxx:8080/USSD/Main.jsp but http://campaigns.dns.co.za does not link to http://41.xxx.xxx.xxx:8080/USSD/Main.jsp

Any help appreciated to finally isolve this.
0
Comment
Question by:shaunwingin
  • 9
  • 4
  • 2
  • +1
21 Comments
 
LVL 8

Expert Comment

by:morsun
ID: 39243740
Could you try adding forward slash at the end? Like:

ProxyPass / http://xxx.xxx.xxx.xxx:8080/USSD/
ProxyPassReverse / http://xxx.xxx.xxx.xxx:8080/USSD/
0
 

Author Comment

by:shaunwingin
ID: 39252723
Hi Morsun,

I tried adding forward slash at the end and now when we click on: http://campaigns.dns.co.za we just get an empty page.

for /var/log/httpd/campaignmanager_access_log
yyy.yyy.yyy.yyy- - [17/Jun/2013:12:18:02 +0200] "GET / HTTP/1.1" 200 1
yyy.yyy.yyy.yyy- - [17/Jun/2013:12:18:33 +0200] "GET / HTTP/1.1" 200 1

We don't get any errors like before.

for /var/log/httpd/campaignmanager_error_log  is empty

Now http://campaigns.dns.co.za:8080/USSD/Main.jsp still links to http://41.xxx.xxx.xxx:8080/USSD/Main.jsp  but http://campaigns.dns.co.za still does not link to http://41.xxx.xxx.xxx:8080/USSD/Main.jsp, so nothing has changed as regards this.

Any ideas?
0
 
LVL 8

Expert Comment

by:morsun
ID: 39252728
What happens when you type http://campaigns.dns.co.za/Main.jsp ?
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Author Comment

by:shaunwingin
ID: 39253133
If we type:http://campaigns.dns.co.za/Main.jsp we get the front page without all the images.

yyy.yyy.yyy.yyy - - [17/Jun/2013:15:15:09 +0200] "GET /Main.jsp HTTP/1.1" 200 2029
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:15:09 +0200] "GET /css/cssFile.css HTTP/1.1" 304 -
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:12:47 +0200] "GET /USSD/images/1.jpg HTTP/1.1" 404 1025
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:12:48 +0200] "GET /USSD/images/3.jpg HTTP/1.1" 404 1025
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:12:48 +0200] "GET /USSD/images/anim.swf HTTP/1.1" 404 1034

if we type: http://campaigns.dns.co.za:8080/USSD/Main.jsp it works but http://campaigns.dns.co.za/Main.jsp does not work.
0
 

Author Comment

by:shaunwingin
ID: 39304349
Say, anyone able to assist please?
0
 

Author Comment

by:shaunwingin
ID: 39306671
Please help. Looking to close this Q soon.
Thank you for your patience.
0
 
LVL 57

Expert Comment

by:giltjr
ID: 39324074
What does the virtualhost  definition look like for port 8080?
0
 

Author Comment

by:shaunwingin
ID: 39324866
<VirtualHost xxx.xxx.xxx.xxx:80>
  ServerName campaigns.dns.co.za
  DirectoryIndex Main.jsp index.html index.htm index.jsp index.php index.html.var
  ErrorLog logs/campaignmanager_error_log
  CustomLog logs/campaignmanager_access_log common
  RewriteRule ^/?campaig(n|ns|nmanager)/* http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp [PT]
  ProxyPreserveHost On
  ProxyPass / http://xxx.xxx.xxx.xxx:8080/USSD
  ProxyPassReverse / http://xxx.xxx.xxx.xxx:8080/USSD
</VirtualHost>

We also tried but it did not help:
 <VirtualHost xxx.xxx.xxx.xxx:80>
  ServerName campaigns.dns.co.za
  DirectoryIndex Main.jsp index.html index.htm index.jsp index.php index.html.var
  ErrorLog logs/campaignmanager_error_log
  CustomLog logs/campaignmanager_access_log common
  RewriteRule ^/?campaig(n|ns|nmanager)/* http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp [PT]
  ProxyPreserveHost On
  ProxyPass / http://xxx.xxx.xxx.xxx:8080/USSD/
  ProxyPassReverse / http://xxx.xxx.xxx.xxx:8080/USSD/
</VirtualHost>
0
 
LVL 8

Assisted Solution

by:morsun
morsun earned 250 total points
ID: 39324906
The config looks fine, maybe besides this PT rewrite rule, could you please send us error logs and access logs from apache from the time when you browse around the page? If you also have access to jboss request or access logs they could also help. From what I have seen before looks like your images folder isn't ported to jboss.
0
 

Author Comment

by:shaunwingin
ID: 39385271
Will get soonest...
0
 

Author Comment

by:shaunwingin
ID: 39411022
Still not there yet....
0
 

Author Comment

by:shaunwingin
ID: 39423653
Hi morsun,

Its not working.  Please help. What else would you like us to try?

Do you have any suggestions to change the httpd.conf?

If we type:http://campaigns.dns.co.za/Main.jsp we get the front page without all the images.  Do you have a suggestion how to see the images?

for /var/log/httpd/campaignmanager_access_log
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:15:09 +0200] "GET /Main.jsp HTTP/1.1" 200 2029
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:15:09 +0200] "GET /css/cssFile.css HTTP/1.1" 304 -
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:12:47 +0200] "GET /USSD/images/1.jpg HTTP/1.1" 404 1025
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:12:48 +0200] "GET /USSD/images/3.jpg HTTP/1.1" 404 1025
yyy.yyy.yyy.yyy - - [17/Jun/2013:15:12:48 +0200] "GET /USSD/images/anim.swf HTTP/1.1" 404 1034

if we type: http://campaigns.dns.co.za:8080/USSD/Main.jsp it works but the actual URL we need is http://campaigns.dns.co.za/Main.jsp which does not work.

We need the URL http://campaigns.dns.co.za to link to http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp which runs in JBoss.7.1.1.Final.
We want a client to click on http://campaigns.dns.co.za and it connect to the URL
http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp
We are using ahoffmann's approach with your suggestion of putting in the /

<VirtualHost xxx.xxx.xxx.xxx:80>
  ServerName campaigns.dns.co.za
  DirectoryIndex Main.jsp index.html index.htm index.jsp index.php index.html.var
  ErrorLog logs/campaignmanager_error_log
  CustomLog logs/campaignmanager_access_log common
  RewriteRule ^/?campaig(n|ns|nmanager)/* http://xxx.xxx.xxx.xxx:8080/USSD/Main.jsp [PT]
  ProxyPreserveHost On
  ProxyPass / http://xxx.xxx.xxx.xxx:8080/USSD/
  ProxyPassReverse / http://xxx.xxx.xxx.xxx:8080/USSD/
</VirtualHost>

If you want actual access to the server so you can try it yourself please let us know and we will give you access.
0
 
LVL 3

Expert Comment

by:RitBit
ID: 39426660
What are the URLs of the images in the forwarded page? (where the images don't work)

It seems like the page is using absolute paths instead of relative urls. If that is the case you might need an extra module mod_proxy_html to modify the urls of the proxied page in the fly. ProxyPassReverse should take care of this but it doesn't work always....

See http://httpd.apache.org/docs/current/mod/mod_proxy_html.html

Please check if the urls in the proxied page are relative or not, and if they refer to the correct path for the image...

Bas
0
 
LVL 8

Expert Comment

by:morsun
ID: 39426674
Hi shaunwingin,

please follow RitBit request, if this is not the case then yes, a broader look at your whole application would be needed.
0
 
LVL 3

Accepted Solution

by:
RitBit earned 250 total points
ID: 39426715
Oh, btw.
You can also try other reverse-proxy modules like mod_ajp  or mod_jk.
All are able to work with JBoss as well.

For mod_proxy there are some examples here: https://community.jboss.org/thread/81271 Not sure if you have tried those actually...

But all those methods will fail if your applicaion is using absolute paths (starting with a /) in which case you the only options left is to either use mod_proxy_html or to rewrite the JBoss applet so it uses relative urls (best solution).

Bas.
0
 

Author Comment

by:shaunwingin
ID: 39446009
We hoped to not need to use mod_ajp  or mod_jk
But if that is the only option we will try and let you know.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 42
Is my HP C7000 enclosure failing? 2 32
Two wordpress questions 3 43
Cpanel file manager 8 22
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Moving your enterprise fax infrastructure from in-house fax machines and servers to the cloud makes sense — from both an efficiency and productivity standpoint. But does migrating to a cloud fax solution mean you will no longer be able to send or re…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to count occurrences of each item in an array.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question