How to remove application path by using httpd config in weblogic plugin - ajax

I developed a JSF application that named myapp was deployed on weblogic 12c http server on managed servers managedServer1 and managedServer2 in same cluster that named mycluster . Application can be access by url http://xx.xx.xx.xx(ip for managedServer1):9080/myapp.
I tried add a apache load balancer http server in the front of weblogic cluster by configure httpd (httpd.conf) as:
<VirtualHost *:80>
ServerName www.mywebsite.com.au
ServerAlias mywebsite.com.au
<Proxy balancer://mycluster>
BalancerMember http://xx.xx.xx.xx1:9080/myapp
BalancerMember http://xx.xx.xx.xx2:9080/myapp
</Proxy>
ProxyRequests off
ProxyPreserveHost On
<Proxy *>
Require all granted
</Proxy>
ProxyPass /myapp balancer://mycluster/
ProxyPassReverse /myapp balancer://mycluster/
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/
<Location />
Require all granted
</Location>
</VirtualHost>
by using this configure, I can access my jsf app by URL
http://www.mywebsite.com.au
directly.
Unfortunately, As my JSF App have quite lots ajax asynch requests in my jsf pages, apache reverse proxy not handle it properly, always cause session lost. I have to find alternative way to fulfil my ajax requests.
I fellow Oracle advice to install weblogic plug in for my apache http server. After installed plug in, I re-configuring my httpd.conf by using:
<VirtualHost *:80>
ServerName www.mywebsite.com.au
<IfModule mod_weblogic.c>
WebLogicCluster xx.xx.xx.xx1:9080,xx.xx.xx.xx2:9080
MatchExpression *.xhtml
</IfModule>
<Location /myapp>
SetHandler weblogic-handler
Require all granted
</Location>
</VirtualHost>
Unfortunately. I have to access my JSF application by call URL:
http://www.mywebsite.com.au/myapp
My question is: Does there is an other way to configure my virtual host to be accessed my JSF app from root? (http://www.mywebsite.com.au) that with out application path. If it is, please advise!

After couple of days work, find a way to solve this issue, httpd.conf was update to:
<Location />
SetHandler weblogic-handler
PathTrim /myapp
PathPrepend /myapp
Require all granted
</Location>
By using PathTrim and PathPrepend to map URL. System works well now.
This issue maybe help any one else who is in the same situation.

Related

Laravel routes behind reverse proxy generating wrong url

Let me explain my situation. I have a server that host five sites in www/html folder using the Apache 2 server but all of them run on PHP 5.4. I was asked to upload a system on this server, but it uses PHP 7+. The system is dockerized, so it contains their own container running php 7. So, I was thinking in use a reverse proxy to redirect the requests to docker container. Ok, I managed to do it. My container is running and I can access the system in production. But the system is broken, the static files and the routes are not being well formed.
This image shows the error in console. I just hid the IPs.
https://i.stack.imgur.com/5dvVe.png
This my Apache configuration in sites-available folder. I just added the Location tag to redirect for my container.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
LimitRequestLine 16382
LimitRequestFieldSize 16382
Timeout 12000
AddDefaultCharset ISO-8859-1
SetEnv no-gzip 1
<Directory /var/www/html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<Location "/educar">
ProxyPreserveHost On
ProxyPass "http://localhost:8001/educar"
ProxyPassReverse "http://localhost:8001/educar"
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
This is my first question here, so I just apologized for any mistake.

Oracle Apex pretty URL

i need help for a problem.
Before someone complain. I have post the same question in another forum but i didn't get any useful help there.
https://community.oracle.com/tech/developers/discussion/4497783
I have seen there are a lot of things if i search by google but i am a total newbie so i hope that someone could help me.
I have a dedicated Server with apex running. I have point a domain to my apex application, so far , so good.
Now i have the url like following www.mydomain.com/apex/workspace_name/r/application
What i want to do is, that the user don't see the part "/apex/workspace_name/r" when he is working with the application.
Is there a relative easy way to do that? Something like .htaccess?
Many thanks and regards,
Andreas
Using an Apache HTTPD web server to reverse proxy your APEX connections, you can use the ProxyPass and ProxyPassReverse directives of the mod_proxy module to alter URL paths that the user sees:
ProxyPass /r /apex/workspace_name/r
ProxyPassReverse /r /apex/workspace_name/r
See the Apache documentation for more details: https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass
In my case, I used the mod_proxy_ajp module to communicate with the cluster of Tomcat application servers running ORDS, as follows:
#######################################################
#
# APEX Virtual Host
#
#######################################################
<VirtualHost 192.168.1.101:443>
# General setup for the virtual host
DocumentRoot "/var/www/html"
ServerName apps.mydomain.com
ServerAdmin root#localhost
ErrorLog "/etc/httpd/logs/apex.ssl_error.log"
# Redirect root URL to a default application
RedirectMatch ^/$ /ords/f?p=200
... other directives here ...
<IfModule mod_proxy_ajp.c>
ProxyRequests Off
ProxyPreserveHost On
<Proxy balancer://ords_balancer>
BalancerMember ajp://appserver1:8009 route=server1
BalancerMember ajp://appserver2:8009 route=server2
</Proxy>
# Redirect /ords to the load balancer
ProxyPass /ords balancer://ords_balancer/ords stickysession=JSESSIONID|jsessionid
ProxyPassReverse /ords balancer://ords_balancer/ords
ProxyPassReverseCookiePath /ords /
# Redirect /i to the load balancer
ProxyPass /i balancer://ords_balancer/i stickysession=JSESSIONID|jsessionid
ProxyPassReverse /i balancer://ords_balancer/i
<Proxy *>
Order deny,allow
Deny from none
Allow from localhost
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
</Location>
</IfModule>
</VirtualHost>

Not propperly routing in reversed proxy Laravel App

I have configurated an Apache Server which uses reverse proxy to show a web app developed in laravel and mounted in another apache web server. Let's say that the domain is myapp.app
Which works properly, but when I click to a subdomain, let's say myapp.app/register the browser returns myapp.appregister/.
At the moment I've configurated my webserver as it follows:
<IfModule mod_ssl.c>
<VirtualHost *:443>
SSLEngine On
ServerName myapp.app
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location "/">
RequestHeader set X-Forwarded-Proto https
RequestHeader set X-Forwarded-Ssl on
RequestHeader set X-Url-Scheme https
</Location>
ProxyPreserveHost on
ProxyPass / http://172.31.0.234/
ProxyPassReverse / http://172.31.0.234/
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias www.redes-erdica.tech
SSLCertificateFile /***.pem
SSLCertificateKeyFile /***.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName myapp.app
Redirect permanent / https://myapp.app/
</VirtualHost>
</IfModule>
And the config file for the inner apache server has no other configurations besides the location of the laravel Project. Some curious event that happens is that if I type manually myapp.app/register it sends me where it should be, so why the browser sends me in a wrong direct when I click in the register button?
In addition, the app in localserver works properly.
You need to modify the main configuration file located on the /etc/apache2 folder, you need to change the value of the section AllowOveride that points to the folder on which your aplication lives and change it like this:
<Directory [your_app_folder]
Options ...
AllowOverride All
Require ...
</Directory>

How to proxy WebSocket via Apache to Play-Framework

I'm stuck with my Apache-config and appreciate any help on this.
The config is like this:
The Apache redirects all http traffic to https
It proxies requests like https://domain.tld/app1 to http://domain.tld:9000/app1 (play apps are running at app-context /app*/...)
This works very well with the following Apache-config:
<VirtualHost *:80>
ServerName domain.tld
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Redirect permanent / https://domain.tld/
Redirect permanent / https://domain.tld/
</VirtualHost>
<VirtualHost _default_:443>
#ssl-config here
<Proxy http://localhost:9000/*>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /app1 http://domain.tld:9000/app1
ProxyPassReverse /app1 http://domain.tld:9000/app1
ProxyPassReverse /app1 http://domain.tld/app1
</VirtualHost>
The problem ist, that one play-application got a WebSocket added. Which isn't working with the above setup. So I read the stuff on the play-pages. Which led me to install mod_proxy_wstunnel. I also add the following lines to the config, but had no success with that:
ProxyPass /app1/timerWs ws://domain.tld:9000/app1/timerWs
ProxyPassReverse /app1/timerWs ws://domain.tld:9000/app1/timerWs
When I'm trying to connect to https://domain.tld/rlc/timerWs I got an 500 Internal Server Error, but there are no new, more specific errors in the apache error log.
How can I configure Apache to proxy WebSocket requests properly to my play applications?
My play-apps do not have https-adapters. All the https stuff is done by the Apache-proxy.
Play-apps are on version 2.5.
Apache is on 2.4.7.
Thanks a lot for your help.
Tobias
I have solved the issue now. What did the trick was to set-up https not only on the Apache, but also on Plays application server Jetty. To do so see this link. This leads to another ProxyPass address (notice the wss instead of ws):
ProxyPass /app1/timerWs wss://domain.tld:9000/app1/timerWs
ProxyPassReverse /app1/timerWs wss://domain.tld:9000/app1/timerWs
I also had to change the WebSocket address in my Javascript, to let the Browser know, where to find the WebSocket-Backend.
$(function() {
var WS = window['MozWebSocket'] ? MozWebSocket : WebSocket
var dateSocket = new WS("wss://domain.tld/rlc/timerWs")
var receiveEvent = function(event) {
$("#timer").html(event.data);
}
dateSocket.onmessage = receiveEvent
});
Before that I used a Play-route #routes.Application.timerWs().webSocketURL(request) to address the WebSocket.

Deploying a Rails 3.1 app to subdirectory in Apache WITHOUT Passenger

Alright, I've been fighting with this all day, so I figure it's time to throw my question out into the masses of Rails users out there and see if anyone can help. :)
I'm restricted to using a Windows box as a server and I have XAMPP running, serving up a static site from htdocs. I also am running a couple of instances of Thin server off of ports 5000 and 5001 to serve up two Rails apps. I'm trying to set up a reverse proxy through Apache so that users can go to http://mydomain.com/app1 or http://mydomain.com/app2. Here's my proxy.conf file:
<Proxy *>
Order deny,allow
Allow from All
</Proxy>
ProxyVia On
ProxyPass /app1 http://localhost:5000/app1
ProxyPassReverse /app1 http://localhost:5000/app1
ProxyPass /app2 http://localhost:5001/app2
ProxyPassReverse /app2 http://localhost:5001/app2
ProxyPreserveHost On
The apps seem to work fine as far as raw content is concerned; however, despite setting ENV['RAILS_RELATIVE_URL_ROOT'] to '/app1' in the environment file for app1 and to 'app2' in the environment file for app2, the javascript, stylesheet, and image tags do not prepend '/app1' or '/app2' to the HREF and SRC attributes of their tabs, resulting in no styling, scripting, or images. I've scoured the internets and tried everything I could find, but nothing seems to works. I have a feeling I'm missing something really basic and I just hope someone can help. :)
Try this...
<Proxy *>
Order allow,deny
Allow from All
</Proxy>
ProxyPreserveHost On
<Location /app1>
ProxyPass http://localhost:5000/app1
ProxyPassReverse http://localhost:5000/app1
</Location>
<Location /app2>
ProxyPass http://localhost:5001/app2
ProxyPassReverse http://localhost:5001/app2
</Location>

Resources