Oracle Apex pretty URL - oracle

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>

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.

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

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.

Host 2 application under one domain Apache HTTPD

I'm trying to configure Apache HTTPD 2.4 to front two different applications being hosted on the same server.
App1 is reachable on port 8080 (Tomcat)
mysingledomain.com:8080
App2 is reachable on port 3030 (Ruby [Dashing])
mysingledomain.com:3030
What I want to do is reach them respectively as mysingledomain.com/App1 and mysingledomain.com/App2
My situation is a lot like how this question start:
Host 2 Sites in HTTPD
These are both SPA applications but I'm getting quite confused on how to set this up when I do not have a DocumentRoot to separate the configuration.
How would I setup HTTPD to front the HTTP requests in this manner?
I was able to configure the ruby application to adhere to a subpath with the following configuration, but this affects the other:
<VirtualHost *:80>
ProxyRequests On # <---- WARNING DO NOT DO THIS
ProxyVia On
ProxyPreserveHost On
RewriteEngine On
ProxyPass "/app2" "http://192.168.0.62:3030/" retry=0
ProxyPassReverse "/app2/" "http://192.168.0.62/"
RewriteRule "^/assets/(.*)" "/app2/assets/$1" [R]
RewriteRule "^/views/(.*)" "/app2/views/$1" [R]
</VirtualHost>
It should be as simple as this:
<VirtualHost *:80>
ServerName mysingledomain.com
ProxyPreserveHost On
ProxyPass /App1/ http://127.0.0.1:8080/
ProxyPassReverse /App1/ http://127.0.0.1:8080/
ProxyPass /App2/ http://127.0.0.1:3030/
ProxyPassReverse /App2/ http://127.0.0.1:3030/
</VirtualHost>

Adding a 8080 to each URl using URl rewriting?

I have a domain like www.mytest.com. Now for each subpage of that page and the domain itself I want to add :8080. Like this:
www.mytest.com/correct.php --> www.mytest.com:8080/correct.php
How can I do that?
Thanks!
You can use proxy pass reverse assuming that you activate (listen on) port 8080 in your httpd.conf file or VirtualHost file assuming you're using Apache HTTPD and have root access. If not, believe you can put this into .htaccess:
<VirtualHost *:80>
...
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.mytest.com:8080
ProxyPassReverse / http://www.mytest.com:8080
</VirtualHost>

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