Skip to content

help request: When upstream return 302, I want to return client follow 302 and return 200.How can i configure? #12750

@LeeZBug

Description

@LeeZBug

Description

When I configure a upstream who return 302 http status code and give Location header ,but I want to apisix follow 302 and get final result to client. I don't find plugin who can do this.

I can use this configuration on Nginx to resolve this ,configuration like this

        location /symbols {
            proxy_intercept_errors on;
            error_page 301 302 307 = @redirect_handler;
            resolver 8.8.8.8 valid=30s;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://msdl.microsoft.com/download/symbols/;
            proxy_set_header Host msdl.microsoft.com;
        }

        location @redirect_handler {
            resolver 8.8.8.8 valid=30s;

            set $redirect_target $upstream_http_location;
            proxy_pass $redirect_target;

            proxy_hide_header Location;
            proxy_set_header Host vsblobprodscussu5shard71.blob.core.windows.net;
            #proxy_set_header Host msdl.microsoft.com;
            proxy_set_header X-Real-IP $remote_addr;
        }

Environment

  • APISIX version (run apisix version): 3.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions