This is a simple reverse proxy to achieve any URL structure you want for your APEX server. NGINX is responsible for handle almost everything, reverse proxy, URL redirection, HTTP/2, cache, gzip, HSTS, OCSP stapling, etc. Tomcat/ORDS/APEX is sitting behind NGINX, communicating with NGINX via HTTP.
This is the stack I am running at the moment.
- NGINX 1.21.1
- Tomcat 9.0.50
- ORDS 21.2.0.r1741826
- APEX 21.1.2
- Line 14, proxy cache setting
- Line 17-20, rediect all HTTP traffic to HTTPS
- Line 24, setup HTTP/2
- Line 27-30, enable gzip
- Line 32-33, SSL key pair. fullchain.cer contains the server public certificate followed by immediate certificate in the same file
- Line 34-38, SSL protocol, chipers setting
- Line 40-42, SSL session cache setting
- Line 44-46, OCSP stapling setting. ca.cer contains only the immediate certificate
- Line 48, add HSTS header
- Line 54-57, proxy timeout setting
- Line 59-63, pass some extra headers to ORDS, so that your app can now where this request originally comes from
- Line 64, Google Chrome enforces stricter CORS rules, than e.g. Firefox. By setting the Origin to blank we can make reverse proxying work, otherwise Chrome would block it
- Line 65, the actual reverse proxy command saying that traffic is internally rerouted to http://127.0.0.1:8080
- Line 80-86, proxy cache setting. We put every file found on a path like /ords/*/r/*files/static/vnnn/ subfolder for at least 24hrs and also send a 300 day expiry header to the client
There is not a lot of changes in Tomcat. Basically we need to ensure HTTP (port 8080) is working, limit access to localhost and adding the actual IP address %{X-Forwarded-For} to tomcat log file.
E:\tomcat9\conf\server.xml- Line 2-3, in some situations APEX internally creates a redirect to a different URL path, e.g. during Authentication using Social-Login it will redirect to …/ords/apex_authentication.callback… With the verison of the stack I am using, these two lines might not be required anymore. I am still leaving them here for the peace of mind.
- Line 14-15, to allow access only for the clients connecting from localhost
- Line 17-26, adding the actual IP address %{X-Forwarded-For} to tomcat log file
No comments:
Post a Comment