I am having some problems setting up an Apache Web Server in front of Jboss.
I rent a vps with apache and jboss running up and working fine separately.
Jboss is working fine when I want to acess my app through http://myVpsUrl.com:8080/myApp/
I am trying to redirect http://myUrl.com to my jboss app.
In Apache conf file I set :
<VirtualHost *:80>
ServerName myUrl.com
ServerAlias myUrl.com
ProxyPass / http://localhost:8080/context/
ProxyPassReverse / http://localhost:8080/context/
ProxyPassReverseCookiePath / /
ProxyRequests On
</VirtualHost>
When I am going to myUrl.com I can reach the web app homepage but :
images and style are missing
All links redirect my to the homepage
My style and images are located in
http://myVpsUrl:8080/context/css/icons/devices-14-20.png
http://myVpsUrl:8080/context/javascript/util.js
http://myVpsUrl:8080/context/images/*
etc...
I tried to add
ProxyPreserveHost On
But I'm getting an error :
The page isn't redirecting properly or Infinite redirection
I am stuck with this error since a week, any help would be sincerely appreciated.
Thank you.
I finally find how to make it work.
1- Create a virtual-server in jboss
jboss-as-7.1.1.Final/standalone/configuration/standalone.xml
<virtual-server name="myVirtualServerName" default-web-module="nameOfWarFile">
<alias name="myurl.com"/>
</virtual-server>
2- Configure jboss-web.xml
<jboss-web>
<virtual-host>myVirtualServerName< /virtual-host>
</jboss-web>
3- Restart Jboss and Deploy you app
=> You should be able to access your app via myurl.com:8080
4- Make a redirection from port 80 to 8080 on apache
<VirtualHost *:80>
ServerName myurl.com
ServerAlias www.myurl.com myurl.com
ProxyPass / http://myurl.com:8080/
ProxyPassReverse / http://myurl:8080/
</VirtualHost>
5- Edit your host file (/etc/host) and add this line
127.0.0.1 myurl.com
6- Restart apache, you should be able to access your jboss via myurl.com
you could try use the rewrite engine.
Try this:
<VirtualHost *:80>
ServerName myUrl.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:8080/context/
ProxyPassReverse / http://localhost:8080/context/
RewriteEngine On
RewriteCond %{THE_REQUEST} /context/
RewriteRule ^/context/(.*)$ /$1 [PT]
</VirtualHost>
Related
I have sucessfully set up an Apache HTTPD web server and ShinyProxy instance so that I can access a set of shiny apps over https (on server runing amazon linux).
When I visit
https://www.example.com
I (as expected) get the login page provided by the web applicaiton (shiny proxy). For now this is set up to use simple authentication.
However when I log in (which is sucessful) the page i am viewing redirects me to http://example.com . I need it to stay on https especially because google auth will not allow you to redirect to an http page.
I think the problem is probably with my apache config file. The relevant part is
<VirtualHost *:80>
ServerName example.com
Redirect / https://www.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/
SSLEngine on
SSLProxyEngine On
SSLCertificateFile <path to crt>
SSLCertificateKeyFile <path to key>
SSLCertificateChainFile <path to bundle>
# This block is needed for the interal workings off the app
<Proxy *>
Allow from localhost
</Proxy>
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://localhost:3600/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://localhost:3600/$1 [P,L]
ProxyPass / http://localhost:3600/
ProxyPassReverse / http://localhost:3600/
ProxyRequests Off
ProxyPreserveHost On
</VirtualHost>
Does anyone have any thoughts about how I might fix this?
I have found a solution, and so am providing the answer in case anyone else is still stuck.
If you are still having this problem for me the issue was the home page image that I was including in my ShinyProxy application.yml file was served over http, so Apache was forcing the whole website back to http. Exchanging the default image for one served over https fixed the problem.
Additionally in the latest version of ShinyProxy (2.4+) you need to include in application.yml under the server block the line
forward-headers-strategy: native
I have a application deployed in tomcat(app1), front end by appache web server. So if i hit onlinetamilportal.com then it will point to onlinetamilportal.com:8080/app1. Which is working fine.
What i want is url rewrite, www.onlinetamilportal.com/showPost.jsp?serial=deivamagal should rewrite www.onlinetamilportal.com/serial/deivamagal. how to acheive this? Tried lot of rewrite rule for the past 4-5 days. Any help will be appreciated.
<VirtualHost *:80>
ServerName www.onlinetamilportal.com
ProxyPass / ajp://127.0.0.1:8009/app1/ smax=0 ttl=60 retry=5
ProxyPassReverse / ajp://127.0.0.1:8009/app1
</VirtualHost>
we are using jbossEAP 6.0 , we have two instances of jboss server in one machine .Both jboss server have same application.
We are unable to access jboss server from different domain .
Suppose user type example.com then it should redirect to localhost:8080 and in the case of demo.com, **localhost:8084. For this we configure in apache 2.0 but it always hitting first configuration available in httpd.conf.
So please suggest me to solve this issue .The httpd configuration is like this
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
ProxyPass / ajp://localhost:8010/
ProxyPassReverse /foo http://example.com/
RewriteEngine On
RewriteRule ^/$ /foo/ [R]
ErrorLog logs/example-error_log
CustomLog logs/example-access_log combined
JkMount /foo/* foo
</VirtualHost>
<VirtualHost *:80>
ServerName www.demo.com
ServerAlias demo.com
ProxyPass / ajp://localhost:8009/
ProxyPassReverse /foo http://demo.com/foo
RewriteEngine On
RewriteRule ^/$ /foo/ [R]
ErrorLog logs/demo-error_log
CustomLog logs/demo-access_log combined
JkMount /foo/* foo
</VirtualHost>
we are not changing any file of jboss server for this configuration.
Do you have this line before defining virtual hosts?
NameVirtualHost *:80
Here is ho I configured it, but didn't used mod_jk.
Two DNS Names for two Web apps in jboss 7.1.1
I have two tomcat servers running in my machine and i want to use apache to redirect the traffic to each server depending on the subdomain.
My httpd.conf is:
<VirtualHost *:80>
ServerName dev.bo.example.com
ProxyPass / ajp://localhost:11009/bo/
ProxyPassReverse / ajp://localhost:11009/bo/
ProxyPassReverseCookiePath /bo/ http://localhost:11001/bo/
</VirtualHost>
<VirtualHost *:80>
ServerName dev.com.example.com
ProxyPass / ajp://localhost:10009/com/
ProxyPassReverse / ajp://localhost:10009/com/
ProxyPassReverseCookiePath /com/ http://localhost:10001/com/
</VirtualHost>
The problem is that the traffic is always direct to the first tomcat server despite the subdomain i use.
It seems that only the first virtual host match despite if i use:
http://dev.com.com.example.com/ or
http://dev.bo.example.com/
Does any know what i am missing here?
Finally, i found that i missed configuration i had to add
NameVirtualHost *:80
to the httpd.conf
Here is the situcation.
I installed OpenERP instance on Amazon EC2 Ubuntu 12.04.
Use serverip:8069 or domain-one.com:8069 to access website is no problem. Then i set up apache reverse proxy to use domain-two.com for openERP, i can't access the website. here is proxy setting:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domain-two.com
RewriteEngine on
RewriteRule ^/(.*) http://localhost:8069/$1 [P]
ProxyPassReverse / http://localhost:8069/
</VirtualHost>
But when i add this to my computer /etc/hosts file:
serverip domain-two.com
and then visit the domain-two.com, successfully visit the OpenERP instance.
domain-two nameserver setting in Route53 is correct. no problem
Where i'm doing it wrong? please help.
Many Thanks!
First check whether your DNS setting is working fine or not using the dig command from linux os.
dig domain-two.com
And then use this configurations and try again.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domain-two.com
ProxyPass / http://localhost:8069/
ProxyPassReverse / http://localhost:8069/
</VirtualHost>
Please dont forget to restart the Apache server. Remember this configuration will not work for SSL based Proxy.