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.
Related
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>
I’ll just briefly explain what I have and what I’d like.
On same server I have a service which has also a web gui on http port 9091 for example. The service does not have a option to change the config to https within the app.
I also have apache on that server for snmp traps graphs. So I’d like to use that apache as a https proxy, so communication to apache is https, from apache to that mentioned web plain http.
Client <-> https proxy <-> http web ui
I don’t want just redirect.
Can you advise me a simple solution. Not lucky yet with search.
Thank you!
Mario
Worked with
<VirtualHost *:8843>
ServerName xxx
ServerAdmin webmaster#localhost
# DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
# Set the path to SSL certificate
# Usage: SSLCertificateFile /path/to/cert.pem
SSLCertificateFile /xxx.crt
SSLCertificateKeyFile /XXX.key
ProxyPreserveHost On
ProxyPass /transmission http://localhost:9091/transmission
ProxyPassReverse /transmission http://localhost:9091/transmission
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>
I'm trying to connect to my websockets server from outside the local network. I deployed a web app based on Laravel, everything works fine when developing locally, but deploying the app to my Raspberry Pi won't let my websockets server work. The problem might be with my Apache config, but I'm not sure. I'm using a Let's Encrypt certificate, so everything is configured as it should in Laravel and in Apache.
The browser can reach the websockets server, but at websocket's console messages it says this: Error during WebSocket handshake: Invalid status line.
It looks like the Websocket server is not returning a 101 code, but I don't know how to debug or fix this. I'm using the 443 port for websockets, so this is my Apache config:
<VirtualHost *:443>
ServerName drink.myhost.org
ServerAlias www.drink.myhost.org
# WEBSOCKETS CONFIG
ProxyRequests off
ProxyPass "/app/ABCFEDG" "ws://127.0.0.1:6001"
ProxyPass "/app/ABCFEDG" "wss://127.0.0.1:6001"
ProxyPassReverse "/app/ABCFEDG" "ws://127.0.0.1:6001/app/ABCFEDG"
ProxyPassReverse "/app/ABCFEDG" "wss://127.0.0.1:6001/app/ABCFEDG"
ServerAdmin webmaster#drink.myhost.org
DocumentRoot /var/www/html/drink/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/drink.myhost.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/drink.myhost.org/privkey.pem
</VirtualHost>
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.