Doing a proxy pass server on apache to tomcat+liferay - apache

I have three sites hosted on liferay, and they use only one portal instance, therefore only one tomcat host.
I configured the virtual host properties on liferay, so when I type www.domain1.com, it goes to the right site.
However, when I type domain1.com, without the www prefix, it goes to the default liferay site.
One solution that I got was to do a proxy and rewrite server with apache 2, with mod_proxy_http and mod_rewrite modules.
The sites like domain1.com are rewritten to www.domain1.com, and I do a proxy pass like this:
ProxyPass / http://localhost:8085
ProxyPassReverse / http://localhost:8085
The tomcat server listens to the 8085 port, and apache listens to 8080.
But when the proxy pass goes on, I get a 403 - forbidden status.
I don't have a site hosted on apache, and I think that's why I got this status.
But I don't want to have any sites on apache, because the sites are on tomcat.
Is there a way to do this proxy setup without hosting a site on apache? Or maybe hosting a
"dummy" site, just to get the proxypass to work.
Specs:
Liferay 6.1
, Tomcat 7.0.27
, Apache 2.x
, Ubuntu Server 12.04
Best Regards!
Guilherme

try it without "/"
ProxyPass http://localhost:8085
ProxyPassReverse http://localhost:8085
or, maybe, you can do it with tomcat configuration: http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#Host_Name_Aliases

Related

How to configure domain server to static IP, Port and Application Name

Sorry if the question is not that clear.
To illustrate what I want to do, I will give an example:
Application Link:
http://123.123.123.123:8080/KagodPaMore/
Domain:
http://www.iyotbihagay.com/
I wanted my application to be accessed using the link:
http://www.iyotbihagay.com:8080/KagodPaMore/
Also, I wanted it to redirect to the link above whenever the user will enter the following links:
http://www.iyotbihagay.com:8080/
http://www.iyotbihagay.com/
I have no idea on how to implement this.
- My application is served in Amazon EC2
- My domain service is on only-domains (but I cannot see any port options there where I could set the port)
- My server is JBoss Wildfly utilizing port 8080
- I have apache web server installed using port 80 (but not used)
- My amazon server (virtual) is configured on Ubuntu 14.04
hope someone could guide me in the right direction since I do not know how I could set this.
TIA
Application Link:
http://123.123.123.123:8080/KagodPaMore/
Domain:
http://www.iyotbihagay.com/
Objective:
http://www.iyotbihagay.com/ OR http://www.iyotbihagay.com/KagodPaMore/
Processes or Steps done to solve the issue:
* Use Apache Virtual Host - Proxy for default port (80):
For ubuntu apache: You may edit the default site configuration (/etc/apache2/sites-available/000-default.conf).
Add Virtual Host for port 80 to serve as proxy for the port 8080 and KagodPaMore application.
<VirtualHost *:80>
ServerName localhost
ProxyPreserveHost On
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /KagodPaMore http://localhost:8080/KagodPaMore/
ProxyPassReverse /KagodPaMore http://localhost:8080/KagodPaMore/
ProxyPass / http://localhost:8080/KagodPaMore/
ProxyPassReverse / http://localhost:8080/KagodPaMore/
</VirtualHost>
Save changes on the site configuration.
Restart Apache 'sudo service apache2 restart'
Now, you may access the application using:
* http://localhost:8080/KagodPaMore/
* http://localhost:8080/
Note: Do this on the server (123.123.123.123).
With this, you access the server like
'http://123.123.123.123/' it will be pointed to 'http://123.123.123.123:8080/KagodPaMore/' Or Locally like 'http://localhost/' it will be pointed to 'http://localhost:8080/KagodPaMore/'
Set your Domain Server's Main Address (Example: OnlyDomains) to '123.123.123.123'.
This is if you will use the domain server's own NS Servers.
For OnlyDomains, edit 'iyotbihagay.com' zone records and set
'#' - A Record -> '123.123.123.123'
'www' - A Record -> '123.123.123.123'
If you will delegate your own NS Server, make sure that you set your NS servers to point to '123.123.123.123'.
This way, you can I can access my web application by:
http://www.iyotbihagay.com/ or http://www.iyotbihagay.com/KagodPaMore/
Good Luck!
You can do:
Map your domain name to IP address, i.e. create A record www.iyotbihagay.com to 123.123.123.123. No need to specify port in here.
If you use Elastic Load Balancer (ELB), you can create a CNAME record to your ELB endpoint.
Configure Apache to accept request from port 80 and redirect it to port 8080. You can use mod_alias or mod_rewrite.
For the same thing, you need to configure JBoss Wildfly to rewrite/redirect the URL. (disclaimer: I'm not familiar with JBoss Wildfly)
Ensure to allow ingress to port 80 and 8080 on your Security Group.

how to load jsf application sits behind apache reverse proxy

I have a jsf 2.x web app serving incoming requests behind apache reverse proxy server. The app name is "foo" hosted on tomcat server in which fqdn is "fooweb.com" and the reverse proxy server's fqdn is "barweb.com".
So I created foo_conf file in the proxy server having following directive:
<VirtualHost *:4443>
ServerName barweb.com
ProxyPass /foo https://fooweb.com:8443/foo
ProxyPassReverse /foo https://fooweb.com:8443/foo
</VirtualHost>
Three scenarios I observed after restarting the proxy server:
If I don't go through reverse proxy server, I have access to resources by entering url of "https://fooweb.com/foo/faces/index.xhtml"
If I go through the proxy server entering url of "https://barweb.com/foo" the server returns "http status 404 - /foo/" to a client.
If I fully specify resource and pass to the proxy server such as "https://barweb.com/foo/faces/index.xhtml" then I have access to resources just fine.
What I would like to achieve is entering "https://barweb.com/foo" would properly points to "https://barweb.com/foo/faces/index.xhtml". I'd appreciate your advice and guidance on this matter. Thank you!

Apache httpd.conf - route request to different port

I have a CentOs 7.1 with Apache httpd running on port 9000.
So if i type in my browser: http://192.168.56.101:9000/ I see the Apache Testing 123 Page.
I also have a GitLab Server running on port 8888, but this port is closed by the firewall.
I want that Apache redirects traffic to http://192.168.56.101:9000/gitlab internally to the GitLab server.
I have done this in my Apache config file /etc/httpd/conf/httpd.conf:
<VirtualHost *:9000>
ProxyPass /gitlab http://192.168.56.101:8888/users/sign_in
ProxyPassReverse /gitlab http://192.168.56.101:8888/users/sign_in
</VirtualHost>
When users browse to http://192.168.56.101:9000/gitlab the login page appears (css seems broken though), but when logging in this appears:
Not Found
The requested URL /users/sign_in was not found on this server.
Is this something that is configurable with Apache and if so how?
Do I need to use some sort of Url-Rewriting, if yes which and how to get started?
All the links in gitlab will presume you are pointing at the original server.
So you need to look at mod_proxy_html to also replace these links in the HTML:
https://httpd.apache.org/docs/2.4/mod/mod_proxy_html.html

Glassfish HTTPS redirect behind SSL offloader and Apache

I have this configuration:
HTTPS load balancer / SSL offloader on port 443
Apache httpd on port 80 (different IP), using ProxyPass, ProxyPassReverse to forward to...
multiple Glassfish domains listening on different ports
Problem: Neither Glassfish nor Apache is aware that the request is HTTPS. Redirects to URLs like "/index.jsp" are being rewritten in Glassfish as http://internal_ip/index.jsp, then ProxyPassReverse rewrites to http://public_ip/index.jsp. Problem is, I need that URL to be http*s*://public_ip/...
How do I fix that - is there some Glassfish configuration I can change, or Apache httpd.conf?
I see two solutions to that:
1) use your loadbalancer to manipulate apaches response (iRule in F5, flex for A10 loadbalancers etc.)
2) set up something on the loadbalancer to send another redirect to requests coming in via HTTP to use HTTPS

How to use Apache as a proxy for JBOSS AS?

I have Apache running and serving PHP but I will also like to run JBOSS for my other web app. JBOSS is running on port 8080 while Apache is running on port 80. If there is a request for URL example.com, I want Apache to handle it because it is PHP backend but for URL example2.com, I want Apache to forward the request to port 8080 to be handled by JBOSS AS.
I appreciate any help in configuring Apache in the way I described it.
You need to use Apache proxy module: http://httpd.apache.org/docs/1.3/mod/mod_proxy.html
Your configuration of proxy will look similar to:
ProxyRequests Off
ProxyPass /foo http://foo.example.com:8080/foo