I have Oracle APEX and authentication server behind of Nginx proxy.
When I go to https://abc.mycompany.com/ords/f?p=105:1::::: I get redirect to auth server with Location
header like this
https://login.mycompany.com/connect/authorize?response_type=code&client_id=APEX105&scope=openid+profile+email&redirect_uri=https://xyz.adb.us-ashburn-1.oraclecloudapps.com/ords/apex_authentication.callback&state=blablalba
How I can replace xyz.adb.us-ashburn-1.oraclecloudapps.com
in the response to abc.mycompany.com
?
curl -I https://abc.mycompany.com/ords/f?p=105:1:::::
HTTP/1.1 302 Found
Location: https://login.mycompany.com/connect/authorize?response_type=code&client_id=APEX105&scope=openid+profile+email&redirect_uri=https://xyz.adb.us-ashburn-1.oraclecloudapps.com/ords/apex_authentication.callback&state=blablalba
Try within the same location
block:
proxy_redirect default;
proxy_redirect ~^(.*[?&]redirect_uri=)([^&]*)(&.*|)$ $1<new_uri_here>$3;