Skip to Main Content

APEX

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

NGINX reverse proxy and friendly urls

randallwijntuinFeb 21 2024

I have an on-premises APEX 23.2 instance running via ORDS on Tomcat. The ORDS url. One of the applications on this instance has pretty URLs enabled. My NGINX server is running on Oracle Linux. My requirement for the reverse proxy is that only one application be available via a subpath on the public URL, e.g.

“my.host/app” should open the application available via “internal-addres/ords/r/workspace/app”

I don't want the subpath “/ords/r/workspace” visible to the end user. Generally I've achieved this with the following configuration

location /app {
proxy_pass internal-addres/ords/r/workspace/app;

proxy_set_header Origin "" ;

proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http://my.host/app https://my.host/app;
}

location /i {
proxy_pass internal-addres/i;

proxy_set_header Origin "" ;

proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http://my.host/i https://my.host/i;
}

This way I'm able to access the login page, however I've noticed several resources not loading because they are pointing to my.host/ords/r/workspace/app/… insead of my.host/app/…

Also, I need to specifically go to my.host/app/login_desktop for the login page, as my.host/app then tries to redirect me to my.host/ords/r/workspace/app

I've tried various ways of using sub_filter to maybe replace the paths in the response that are incorrect, to no avail or success. I've also tried to find a way in the instance or application to force the hostname and path of generated URLs, but could not find any.

What am I missing or doing wrong in the config?

Comments
Post Details
Added on Feb 21 2024
0 comments
181 views