When I go back from any page to home page it does not take me to mycustomdomain.com/home it takes me to mycustomdomain.com/ords/r/myapp/sample-charts/home.
Here is the code:
#http server block(port 80) -Redirects to HTTPS
server {
listen 80;
server_name mycustomdomain.com www.mycustomdomain.com;
#Redirect all HTTP traffic to HTTPS
return 301 https://$host$request_uri;
}
#https server block(port 443)
server{
listen 443 ssl;
server_name mycustomdomain.com www.mycustomdomain.com;
ssl_certificate /etc/ssl/mycustomdomain/SSLCertificate/hm_certificate.crt;
ssl_certificate_key /etc/ssl/mycustomdomain/SSLCertificate/hm_privatekey.key;
ssl_trusted_certificate /etc/ssl/mycustomdomain/SSLCertificate/hm_cabundle.ca-bundle;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers off;
#Document root and other settings
root /var/www/html;
index index.html index.htm index.php;
#Security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always;
add_header Pragma "no-cache" always;
#Proxy to Oracle APEX app
location = / {
rewrite ^/$ /home permanent;
}
location /home {
proxy_pass https://myinstance0123.adb.eu-milan-1.oraclecloudapps.com/ords/r/myapp/sample-charts/home;
proxy_set_header X-Forwarded-Host $host;
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_set_header Cookie $http_cookie;
proxy_cookie_path /ords/ /;
proxy_redirect https://myinstance0123.adb.eu-milan-1.oraclecloudapps.com/ https://mycustomdomain.com/;
}
location / {
rewrite ^/([^/]+)$ /ords/r/myapp/sample-charts/$1 break;
proxy_pass https://myinstance0123.adb.eu-milan-1.oraclecloudapps.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Cookie $http_cookie;
proxy_pass_request_headers on;
proxy_cookie_path /ords/ /;
proxy_redirect https://myinstance0123.adb.eu-milan-1.oraclecloudapps.com/ https://mycustomdomain.com/;
}
location /i/{
proxy_pass https://myinstance0123.adb.eu-milan-1.oraclecloudapps.com/i/;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}