小编Tom*_*wer的帖子

Spring Cloud Gateway 和 NGINX

我是否仍然需要 NGINX 来提供 JS 等静态内容以及向后端反向代理请求,或者仅使用 Spring Cloud Gateway 即可完成?Spring 文档有以下图像:

我在那里没有找到有关如何将静态内容返回给客户端的描述,这是否意味着它被认为是不好的做法,并且我需要反向代理的额外步骤来增加其延迟?如果没有,我在哪里可以找到有关如何使用 Spring Cloud Gateway 执行此操作的更多信息,特别是如果我要使用 Spring Gateway 进行 oauth2 授权代码流身份验证?

reverse-proxy oauth nginx spring-cloud-gateway

5
推荐指数
1
解决办法
2115
查看次数

NGINX 不会在 auth_request 302 上重定向

我有一个 NGINX 反向代理,也使用以下配置在 / 上提供静态内容

    location / {
        auth_request /authn;
        proxy_intercept_errors on;
        recursive_error_pages on;
        error_page 301 302 303 307 308 = @handle_redirect;
        gzip_static on;
        index   index.html;
        root /usr/share/nginx/html;
        try_files $uri $uri/ @index;
    }

    location /authn {

        set $target http://gateway:8030/authn;
        proxy_pass http://gateway:8030/authn;
        proxy_pass_request_body off;
        proxy_set_header Content-Length "";
        proxy_set_header X-Original-URI $request_uri;
        proxy_pass_request_headers on;
        proxy_intercept_errors on;
        recursive_error_pages on;
        error_page 301 302 303 307 308 @handle_redirect;
    }

    location @handle_redirect {
            proxy_set_header Host $host:$server_port;
            set $redirect_url $upstream_http_location;
            proxy_pass $redirect_url;
        }

Run Code Online (Sandbox Code Playgroud)

目标是通过对 /authn 端点的子请求进行身份验证来检查用户,如果用户不是,它将返回 302 和 …

redirect oauth nginx

5
推荐指数
1
解决办法
737
查看次数