Very useful for understanding what is going on in nginx proxy.
pip3 install mitmproxy
Config: ~/.mitmproxy/config.yaml
Quick documentation:
location /app/ { proxy_pass http://localhost:1234/app; ... }
The initial response is ok, i.e. the page at /app
is obtained.
But the other requests are not going through, i.e. /app/static/...
.
The page to be served is /app/#/login
, but somehow that redirects to /app
.
Thought it might be this issue: https://stackoverflow.com/questions/36688891/nginx-redirect-to-url-with-url
Inspection of response headers show in console: style not applied due to 'text/html' not a spreadsheet type, and strict MIME check is enabled.
, and under network: Status: 302 Found; Content-Type: text/html;
for a .css file.
Tried adding MIME types: https://stackoverflow.com/questions/29573489/nginx-failing-to-load-css-and-js-files-mime-type-error
But ultimately I still don't know what request is being proxied.
Tried mirroring requests: http://nginx.org/en/docs/http/ngx_http_mirror_module.html A good article on what mirroring actually does. https://alex.dzyoba.com/blog/nginx-mirror/
Used mitmproxy, quite easy to setup, esp since backend is http and not https.
Notice how the URI forwarded is /appstatic/
and not /app/static/
Some lessons learnt?