Reverse proxy error after first call : nginx configuration with AWS hosted app


I am using nginx configuration for reverse proxy in my angular application hosted on AWS ECS.

Follwed guidelines from below link, configuration setting mentined for cloud hosting environment.
How to use auth proxy with nginx? .

When I see in AWS cloudwatch logs, I get following sequence of calls, First call is 200 status. But something going wrong after this call.

*“GET /grafana/d/_0uzKUMZk/messages-throughput?orgId=1 HTTP/1.1” 200 7236 “” *

*987 open() “/usr/share/nginx/html/grafana/public/build/grafana.dark.e7f4da0898a00c92f24e.css” failed (2: No such file or directory), client: 10.2XX.XX.XX, server:, request: “GET /grafana/public/build/grafana.dark.e7f4da0898a00c92f24e.css HTTP/1.1”, host: “”, referrer: “

“GET /grafana/public/build/grafana.dark.e7f4da0898a00c92f24e.css HTTP/1.1” 404 185 “

and so on 404 for few more calls.

Inspecting on chrome developer tool Network log, getting following status.

Request URL:
Request Method: GET
Status Code: 404

Note: Such issue I did not face with same NGINX configuration running while my app locally,(as https://localhost/grafana/d/_0uzKUMZk/messages-throughput?orgId=1) getting 200 for above mentioned Request URL and I able to invoke grafana successfully.

I am new to nginx, my understanding is that after invoking /grafana/ {} from location section of nginx configuration. Grafana trying to find several css and js files(vendor.w7f4da0898a00c92f24w.js, app.w7f4da0898a00c92f24w.js etc.) from …/grafana/public/build/app.w7f4da0898a00c92f24w.js location and its not finding(404 error).

At the end I am not able to successfully invoke grafana through reverse proxy. If anyone could enlighten me whats going wrong or what I am missing?


Replacing /grafana/{} to ~ ^/grafana/(.*){} pattern in location block resolved the issue.