Redirecting http request to two different weblogic servers using the Weblogic proxy and Apache2 - apache

I've read previous posts like "Redirecting https requests to two different weblogic servers using the Weblogic proxy and Apache2". But I have a different situation and I don't think I'm understanding this to well.
I have an Apache 2 server (server1) that will receive http request for my application. Then I have two more servers (server2 and server3) with Web Logic 9.2 runing on ports 7000 (server1) and 8000 (server2).
I want the users to enter appname.domain.com and be redirected between the two web logic servers, always keeping appname.domain.com (this is hidding servername:port from URL).
How can I manage to do that?
Thanks in advance!
Jhon.

Use the Apache HTTP Server plug-in provided by BEA/Oracle to front and load balance request to your application.
I'd use a virtual host here, something like this:
<VirtualHost xxx.xxx.xxx.xxx:80>
DocumentRoot "C:/test/VirtualHost1"
ServerName appname.domain.com
<IfModule mod_weblogic.c>
#... WLS parameter ...
WebLogicCluster 192.168.1.100:7000,192.168.1.200:8000
# Example: MatchExpression *.jsp <some additional parameter>
MatchExpression *.jsp PathPrepend=/test
</IfModule>
</VirtualHost>
This config should balance requests to http://appname.domain.com/
to http://192.168.1.100:7000/test and http://192.168.1.200:8000/test.
Refer to the official documentation for all the details:
Installing and Configuring the Apache HTTP Server Plug-In
Parameters for Web Server Plug-Ins
and also Thread: Installing and Configuring the Apache HTTP Server Plug-In

Install an Webgate on HHTp server incase of Orcle, which will do the reverse proxy and hide the server name.

Related

Cannot log into GeoServer 2.19 with SSL

I am able to reach the GeoServer log-in form on a new server instance using a URL like this: https://sub.domain.tld/geoserver.
However, entering the correct username and password causes Cannot POST /geoserver/j_spring_security_check to be displayed in plain text in the browser window and "http://localhost:8080/geoserver/j_spring_security_check" to appear on the address line (Chrome and Firefox). Logging-in works just fine from http://sub.domain.tld:8080/geoserver and, while logged in that way, the SSL URL will skip the log-in form entirely and open the full GUI -- but none of the example layer previews will work (Cannot GET /geoserver/tiger/wms ...or whatever layer).
I have 3 similar servers set up with earlier software versions that all work perfectly:
CentOS Linux release 7.5.1804 (Core)
Apache 2.4.6
Tomcat 9.0.4.0
JVM 1.8.0_171-b10 (Oracle)
GeoServer 2.15.1 (also 2.14.1)
This latest server is:
CentOS Linux release 7.9.2009 (Core)
Apache 2.4.6
Tomcat 9.0.48.0
JVM 1.8.0_292-b10 (Red Hat)
GeoServer 2.19.1
I closely followed the GeoServer install procedure found here. Apache was already installed and working with a virtual host configuration using certbot and a Let's Encrypt certificate. I added the following to the <VirtualHost *:443> section of the /etc/httpd/sites-available/sub.domain.tld.conf file:
ProxyRequests Off
ProxyPass /geoserver http://localhost:8080/geoserver
ProxyPassReverse /geoserver http://localhost:8080/geoserver
<Location "/geoserver">
Order allow,deny
Allow from all
Header set Access-Control-Allow-Origin "*"
</Location>
I also set "https://sub.domain.tld/geoserver/" as the Proxy Base URL in GeoServer. This is exactly how my working instances are set up.
The newest /opt/tomcat/webapps/geoserver/WEB-INF/web.xml file is slightly different in that it has separate CORS sections to be uncommented for Jetty vs. Tomcat. The Tomcat section and the cross-origin filter-mapping are uncommented. Unlike before, I had to enable the SELinux httpd_can_network_connect process in order to get to the GeoServer log-in form via SSL. Disabling SELinux enforcement, however, does not solve the j_spring_security_check problem.
Sensitive WMS and WFS content must be served via SSL. I am now spinning my wheels on research so any help in resolving this would be greatly appreciated!
I was running into a similar problem trying to reverse proxy a Geoserver docker container using Apache.
After bashing my head for a few days, I found I needed a couple of changes on both ends of the setup.
Apache:
<Location "/geoserver">
ProxyPreserveHost On
ProxyPass http://localhost:8080/geoserver
ProxyPassReverse http://localhost:8080/geoserver
</Location>
The ProxyPreserveHost directive should ensure that sub.domain.tld is what's used rather than localhost.
However, at this point I hit another problem, no matter what I did the login & logout URLs were using http:// and not https://
This required adjusting the server config of Tomcat, specifically the scheme used by the connector.
Tomcat:
<Connector
port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
scheme="https"
/>
Note the value of scheme is https, normally it's http because it's the http connector. This connector doesn't SSL/TLS encrypt the traffic so it would, under normal circumstances (appropriately), set the protocol to http.
Since we're using a proxy for SSL/TLS encryption we don't need Tomcat to do that work but we still need to tell Tomcat to describe the server name using https instead of the usual http.
Alternatively, you could also look at using the AJP connector which is an entirely different protocol but gets around some of these issues rather neatly and can be more performant.
The issue with this approach is that it requires more Apache mods to be enabled to work as well as some security concerns given how much more powerful AJP can be VS the http connector.
Also, there are some other proxy settings that can be used in Tomcat to possibly remove the need for ProxyPreserveHost in Apache, but this should get you where you're going.
Additional reading:
Tomcat HTTP Connector docs: https://tomcat.apache.org/tomcat-9.0-doc/config/http.html
Tomcat AJP docs: https://tomcat.apache.org/tomcat-9.0-doc/config/ajp.html

websphere and apache server proxy and rewrite configuration

There are javaEE applications run on WebSphere server.
The thing I wanna do that to configure a http server that takes the request and redirect to my local websphere server.
For example:
This is live Project testProject.com/Otel..
I wanna reach my local project when I insert local.testProject.com/Otel..
The thing I have done so far I can reach my local apache server when I click local.testProject.com just with adding in host file in windows/system32/drivre/etc directory.
The thing I could not do so far. redirecting this incoming request to my apache server to websphere server.
Could you please help me on these. Dont hasitate to ask further questions.
I would be appreciated if you could give me some ideas with just commenting at least.
Good days..
IBM provides a specialty reverse proxy module for Apache called the WebSphere WebServer Plug-in. Its use is described in detail in the websphere documentation.
In simple configurations, you can just configure any server you already have as a reverse proxy.
Load mod_proxy and mod_proxy_http (varies depending on Apache distribution)
Append to your virtual host:
ProxyPreserveHost ON
ProxyPass /otel http://washostname.example.com/otel
# ProxyPassReverse likely not required in your case.
Of course there are thousands of places to read about setting up Apache as a reverse proxy and there are nearly no WebSphere specifics.

Apache Reverse Proxy Issue

I am trying to user mod_proxy to set up the reverse proxy for multiple web application using a single Apache web server (version 2.4).
I have two applications running on two different tomcat servers:
1. http://app.test.com:8080/app
2. http://app.test.com:8090/app
I have enabled the required modules in the httpd.conf file and added the below lines to the same:
> ProxyPass /App1/ http://app.test.com:8080/app
> ProxyPassReverse /App2/ http://app.test.com:8090/app
The issue is when I test this using below URL
http://rp.test.com:80/App1/ and http://rp.test.com:80/App2/,the apache webserver does send me to the apps hosted on tomcats but gives a 404 error on clicking any internal link of the application.
Think I am missing some configuration part here. Any suggestions?
You also need to configure Tomcat connectors behind the proxy. Somethink like this, containing your external server name and port.
<Connector port="8081" ...
proxyName="www.mycompany.com"
proxyPort="80"/>
To adjust the path in the URL, you may use the proxypassreversepath directive, see:
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreversecookiepath
ProxyPassReverseCookiePath /App1/ /app/

Apache2 reverse proxy multiple sources into one http connection

I'm trying to create a proxy on my Apache2 web server. It's not really pertinent to the question, but I have a Raspberry Pi running a music player with an HTTP interface attached to an unrestricted internet connection. I want to be able to control the music from a work machine which is behind a content filter that blocks Spotify.
Client ---> Content Filter ----> My proxy ---> Unblocked target server
|
|
/
Blocked content
I want clients to be able to connect to my proxy server and view the pages on my unblocked target server. I am currently able to do this using the following code in my VirtualHost section:
<Location "/foo">
ProxyPass "http://targetserver/bar"
Order allow,deny
Allow from all
</Location>
This allows me to see the page when I visit http://myproxy/foo but it doesn't load completely. I know that this is from content that is being blocked by a content filter that I cannot influence.
How do I configure my Apache2 proxy server to also forward the content that the client would normally receive from external servers? I want my proxy server to provide all the content to the client for this web interface opaquely.
Thanks in advance for your time.
Solved it!
I needed to proxy the websockets as well. Adding the following lines worked:
ProxyPass /foo/ ws://targetserver/bar/
ProxyPassReverse /foo/ ws://targetserver/bar/

reverse proxy apache to localhost server

I've got a web app running on localhost:3000. I also have an apache server. I would like to reverse proxy the apache server so that requests to /mywebapp get forwarded to the server running on localhost:3000.
I currently have the following config at the bottom of my httpd.conf file, but I'm getting a server error when I try to access it:
ProxyPass /mywebapp http://localhost:3000
ProxyPassReverse /mywebapp http://localhost:3000
Edit - further details:
I'm running a jetty server with java -jar myapp.jar. I'd like to forward requests to an apache server listening on :80 to the jetty server.
I've got mod_proxy_http.so and mod_proxy.so enabled.
I can tell the server is running on localhost - it responds to curl with the appropriate http response. So I'm pretty sure the issue is with my apache setup, but I can't think what the problem would be.
Apache conf file in conf.d for reference: http://pastebin.com/vhXwjbQe
And I've got this in my httpd.conf:
Include conf.d/*.conf
It's hard to give a generic answer because every situation is different so here are some debugging questions to ask yourself:
if the protocol and port correct on the internal service, http and 3000.
Is the service actually listening for connections from localhost? is it running in a docker container etc that would require it to be listening on a different interface? You can check for this by looking at the output from mywebapp's logs and see if the request are making it through the proxy.
Do the paths on the internal service include the prefix that is being passed to Apache or does apache need to strip these off. if for instance mywebapp expects the path "/foo/bar" and apache's reverse proxy is sending it with the context path included "/mywebapp/foo/bar" then it will not match any path in mywebapp.