Nginx 反向代理动态授权头不起作用

问题描述

当我在 Nignx.conf 中对 Authorization 标头进行硬编码时,它工作正常,但是当尝试使用传递参数动态传递它时,它不起作用。 硬编码部分(工作正常):

location ^~ / {
    #Authorization is hard coded which is working fine.
    set $key1 ZENvUXozb0JGUWU4NTlITERVZzI6ZG8yaklicWNTbi1YMXNIVnlQNE5Hdw;   
    proxy_set_header Authorization "ApiKey $key1";
    # Forward requests to Kibana
    proxy_pass https://timized-deployment-e.kb.us-east-1.aws.found.io:9246;

使用 URL 参数动态传递(不起作用):

https://d301sdsd.cloudfront.net/goto/2d31b9fc5d6154b01438f2cefe813a03?ZENvUXozb0JGUWU4NTlITERVZzI6ZG8yaklicWNTbi1YMXNIVnlQNE5Hdw

    location ^~ / {
    #Authorization is ha
    set $key1 $args;   
    proxy_set_header Authorization "ApiKey $key1";
    # Forward requests to Kibana
    proxy_pass https://i-o-optimized-deployment-e684e2.kb.us-east-1.aws.found.io:9243;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)