Nginx as a reverse proxy for kibana gives 401 for /31997/bundles resources

I am using 7.8.0 version of kibana and elasticsearch. on the front i have configured nginx 1.19 as a reverse proxy.
i have put following configurations on nginx.conf but when i hit https://DNS:4443 (Nginx url) it ends up with an error
https://DNS:4443/31997/bundles/...js files with 401 error. I have put a configuration like if url does not have embed query string it should gives 401 response.

location ~ (/favicon.ico|/*.js|/*.css|/*font*|/elasticsearch/|/app/|/bundles/|/kibana/|/status|/plugins|/ui|/31997/|/logout|/login|/translations/|/node_modules/|/built_assets/|/es_admin/|/api/|/spaces/enter) {
        error_page 420 = @validrequest;
        return 420;
    }
    location / {
        error_page 420 = @validrequest;
        if ( $arg_embed != "true" ) { return 401; }
        return 420;
    }
    location @validrequest {
        proxy_set_header  Host $host;
        proxy_set_header  X-Real-IP $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  Authorization "ApiKey API_KEY_DATA";
        proxy_pass  https://KIBANA_ACTUAL_DSN:8080; # actual kibana URL
    }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.