Closed juliusbsimon closed 2 years ago
The COALESCE function is perfect for code like this. It returns the first non-null value, and it doesn't even have to evaluate/execute all the options if a non-null value is found. It's both faster and easier to read.
l_headers(l_idx).host := coalesce(owa_util.get_cgi_env('X-Forwarded-For'), owa_util.get_cgi_env('REMOTE_ADDR'), sys_context('userenv','host'));
Added to V2 of the audit tool
For systems behind proxies the IP address will usually by the proxy IP. This applies to anyone using APEX and ORDS.
The following can be used instead.
l_headers(l_idx).host := nvl(NVL(owa_util.get_cgi_env('X-Forwarded-For'),OWA_UTIL.get_cgi_env('REMOTE_ADDR')),sys_context('userenv','host'));