Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 641
  • Last Modified:

how to get Apache to use backend Jboss website

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
shaunwingin
Asked:
shaunwingin
  • 9
  • 4
  • 2
  • +1
2 Solutions
 
morsunCommented:
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
 
shaunwinginAuthor Commented:
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
 
morsunCommented:
What happens when you type http://campaigns.dns.co.za/Main.jsp ?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
shaunwinginAuthor Commented:
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
 
shaunwinginAuthor Commented:
Say, anyone able to assist please?
0
 
shaunwinginAuthor Commented:
Please help. Looking to close this Q soon.
Thank you for your patience.
0
 
giltjrCommented:
What does the virtualhost  definition look like for port 8080?
0
 
shaunwinginAuthor Commented:
<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
 
morsunCommented:
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
 
shaunwinginAuthor Commented:
Will get soonest...
0
 
shaunwinginAuthor Commented:
Still not there yet....
0
 
shaunwinginAuthor Commented:
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
 
RitBitCommented:
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
 
morsunCommented:
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
 
RitBitCommented:
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
 
shaunwinginAuthor Commented:
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 9
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now