mitmproxy/web
Ariel e20a24b54e
fix(web): render AVIF images and IANA icon favicons in the response tab (#8232)
* fix(web): render AVIF images and IANA icon favicons in the response tab

The `ViewImage` regex in `HttpMessage.tsx` rejected two valid image
content types, so the response tab did not render them inline:

1. `image/avif` was missing from the alternation. AVIF is widely served
   by image CDNs and decoded natively in `<img>` by Chrome 85+,
   Firefox 93+, and Safari 16.1+.
2. `image/vnd.microsoft.icon` (the IANA-canonical `.ico` MIME) never
   matched because the alternation had `vnc.microsoft.icon` — a
   `vnc`/`vnd` typo. The de-facto legacy `image/x-icon` continued to
   work, which made the bug easy to miss. The dots are also unescaped,
   so the regex coincidentally matches `image/vncXmicrosoftXicon` for
   any single character `X`.

Added `avif`, corrected `vnc` → `vnd`, and escaped the dots. Added a
`ViewImage.matches` unit test covering both the additions and the
existing image MIME types.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-05-15 10:12:27 +02:00
..
gen eslint: consistent-type-imports (#7975) 2026-01-02 01:44:09 +01:00
public/static Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00
src fix(web): render AVIF images and IANA icon favicons in the response tab (#8232) 2026-05-15 10:12:27 +02:00
.editorconfig
.prettierignore
eslint.config.mjs eslint: consistent-type-imports (#7975) 2026-01-02 01:44:09 +01:00
index.html Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00
jest.config.js Web: Show Local timezone in the Timing tab (#7804) 2025-08-08 08:08:30 +02:00
package-lock.json Web: Remove Bootstrap dependency and keep mitmweb styling parity (#8147) 2026-05-12 16:15:20 +02:00
package.json Web: Remove Bootstrap dependency and keep mitmweb styling parity (#8147) 2026-05-12 16:15:20 +02:00
README.md Update node.js version (#7992) 2025-11-24 18:46:06 +00:00
setup-global-jest.js Web: Show Local timezone in the Timing tab (#7804) 2025-08-08 08:08:30 +02:00
setup-jest.js Web: Show Local timezone in the Timing tab (#7804) 2025-08-08 08:08:30 +02:00
tsconfig.json Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00
vite.config.ts Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00

Quick Start

  • Install mitmproxy as described in ../CONTRIBUTING.md
  • Run node --version to make sure that you have at least Node.js 24 or above.
  • Run cd ./web to change to the directory with package.json.
  • Run npm install to install dependencies.
  • Run uv run mitmweb
  • Run npm start in a separate window to start the Vite development server for the web interface.

Testing

  • Run npm test to run the test suite.

Code formatting

Architecture

There are two components:

Contributing

We very much appreciate any (small) improvements to mitmweb. Please do not include the compiled assets in mitmproxy/tools/web/static in your pull request. Refreshing them on every commit would massively increase repository size. We will update these files before every release.

Developer Tools