1

I am trying to setup OEM behind nginx reverse proxy. Here is my nginx config.

 location ~* "^/em/(.*)" {

            add_header X-debug-message "Just for testing" always;

            proxy_redirect https://em/ https://local.mydomain.com:8080/em/;
            rewrite ^/em/em/(.*) ^/em/$1 break;
            proxy_cookie_path ~^(.+)$ "/em; domain=.mydomain.com";

            proxy_pass https://em/em/$1;

        }

Here are the request and response data for first 4 pages after which it keeps redirecting last page in a loop.

Request URL: https://local.mydomain.com:8080/em/
Request Method: GET
Status Code: 302 Moved Temporarily
Remote Address: 192.168.56.102:8080
Referrer Policy: no-referrer-when-downgrade
Connection: keep-alive
Content-Language: en
Content-Type: text/plain
Date: Thu, 19 Dec 2019 14:48:23 GMT
Location: https://local.mydomain.com:8080/em/em/login.jsp
Server: nginx/1.15.8
Set-Cookie: ORA_SMP_EM_AUTH_27122419296023168200=YFEeoZWcMPfA8gQQ82F0czCIcgA5rumW3-u1gJZ8DZ0W8Zr6Uxpa!371330538; path=/em; domain=.mydomain.com; secure; HttpOnly
Transfer-Encoding: chunked
X-debug-message: Just for testing
X-ORCL-EMOA: true
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,pa;q=0.8
Cache-Control: no-cache
Connection: keep-alive
Cookie: ORA_SMP_EM_AUTH_27122419296023168200=ZY0aWFKYSHRDLT5NpsYrDVJ6lnMQbzAR5LGitj2FDX5zJExGpuFi!371330538; __cfduid=d490c5ed0fba5408abb5ffebaf9e1ad561548864527; _ga=GA1.2.147384809.1548864525
Host: local.mydomain.com:8080
Pragma: no-cache
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36
---------------------------------------------------------------------------------------------------------------------------------
Request URL: https://local.mydomain.com:8080/em/em/login.jsp
Request Method: GET
Status Code: 302 Moved Temporarily
Remote Address: 192.168.56.102:8080
Referrer Policy: no-referrer-when-downgrade
Connection: keep-alive
Content-Language: en
Content-Type: text/html; charset=UTF-8
Date: Thu, 19 Dec 2019 14:48:24 GMT
Location: https://local.mydomain.com:8080/em/em/faces/logon/core-uifwk-console-login
Server: nginx/1.15.8
Transfer-Encoding: chunked
X-debug-message: Just for testing
X-ORACLE-DMS-ECID: 005aWybD0OcE8T0_zxDCiW0001L^000NGP
X-ORCL-EMOA: true
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,pa;q=0.8
Cache-Control: no-cache
Connection: keep-alive
Cookie: ORA_SMP_EM_AUTH_27122419296023168200=YFEeoZWcMPfA8gQQ82F0czCIcgA5rumW3-u1gJZ8DZ0W8Zr6Uxpa!371330538; __cfduid=d490c5ed0fba5408abb5ffebaf9e1ad561548864527; _ga=GA1.2.147384809.1548864525
Host: local.mydomain.com:8080
Pragma: no-cache
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36
---------------------------------------------------------------------------------------------------------------------------------
Request URL: https://local.mydomain.com:8080/em/em/faces/logon/core-uifwk-console-login
Request Method: GET
Status Code: 200 OK
Remote Address: 192.168.56.102:8080
Referrer Policy: no-referrer-when-downgrade
Cache-Control: no-cache
Connection: keep-alive
Content-Encoding: gzip
Content-Language: en
Content-Type: text/html;charset=utf-8
Date: Thu, 19 Dec 2019 14:48:24 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: nginx/1.15.8
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-debug-message: Just for testing
X-ORACLE-DMS-ECID: 005aWybE49ZE8T0_zxDCiW0001L^000Ma1
X-ORCL-EMOA: true
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,pa;q=0.8
Cache-Control: no-cache
Connection: keep-alive
Cookie: ORA_SMP_EM_AUTH_27122419296023168200=YFEeoZWcMPfA8gQQ82F0czCIcgA5rumW3-u1gJZ8DZ0W8Zr6Uxpa!371330538; __cfduid=d490c5ed0fba5408abb5ffebaf9e1ad561548864527; _ga=GA1.2.147384809.1548864525
Host: local.mydomain.com:8080
Pragma: no-cache
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36
---------------------------------------------------------------------------------------------------------------------------------
Request URL: https://local.mydomain.com:8080/em/em/faces/logon/core-uifwk-console-login?_afrLoop=5008527327684549&_afrWindowMode=2&Adf-Window-Id=w0
Request Method: GET
Status Code: 200 OK
Remote Address: 192.168.56.102:8080
Referrer Policy: no-referrer-when-downgrade
Cache-Control: no-cache
Connection: keep-alive
Content-Encoding: gzip
Content-Language: en
Content-Type: text/html;charset=utf-8
Date: Thu, 19 Dec 2019 14:48:24 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: nginx/1.15.8
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-debug-message: Just for testing
X-ORACLE-DMS-ECID: 005aWybFUTEE8T0_zxDCiW0001L^000Ma2
X-ORCL-EMOA: true
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,pa;q=0.8
Cache-Control: no-cache
Connection: keep-alive
Cookie: ORA_SMP_EM_AUTH_27122419296023168200=YFEeoZWcMPfA8gQQ82F0czCIcgA5rumW3-u1gJZ8DZ0W8Zr6Uxpa!371330538; __cfduid=d490c5ed0fba5408abb5ffebaf9e1ad561548864527; _ga=GA1.2.147384809.1548864525
Host: local.mydomain.com:8080
Pragma: no-cache
Referer: https://local.mydomain.com:8080/em/em/faces/logon/core-uifwk-console-login
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36
_afrLoop: 5008527327684549
_afrWindowMode: 2
Adf-Window-Id: w0
---------------------------------------------------------------------------------------------------------------------------------

When I am calling the page directly without nginx reverse proxy, it works and use similar headers. I am using https connection for nginx.

2
  • Your use of $1 is ambiguous. You should use a named capture in the location regex. Commented Dec 19, 2019 at 17:20
  • @RichardSmith, thank you. I will make this change. But it still doesn't solve the issue I am facing. Commented Dec 19, 2019 at 20:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.