【问题标题】:Nginx reverse proxy replace part of location URLNginx 反向代理替换部分位置 URL
【发布时间】:2020-07-06 05:19:21
【问题描述】:

我在 Nginx 代理后面有 Oracle APEX 和身份验证服务器。

当我转到https://abc.mycompany.com/ords/f?p=105:1:::: 时:我会重定向到带有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

如何在对abc.mycompany.com 的响应中替换xyz.adb.us-ashburn-1.oraclecloudapps.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

【问题讨论】:

  • 如何从 nginx 连接到后端?使用proxy_pass 指令?
  • 是的,使用proxy_pass https://xyz.adb.us-ashburn-1.oraclecloudapps.com/ords/;

标签: nginx redirect url-rewriting header oracle-apex


【解决方案1】:

在同一个location 块内尝试:

proxy_redirect default;
proxy_redirect ~^(.*[?&]redirect_uri=)([^&]*)(&.*|)$ $1<new_uri_here>$3;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-18
    • 1970-01-01
    • 1970-01-01
    • 2018-11-12
    • 2016-02-26
    • 2019-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多