<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: 1.28.1</li>
<li>Operating System: Mac</li>
<li>Node.js version: 18.10</li>
<li>Visual Studio Code version: 1.73.1</li>
<li>Playwright for VSCode extension version: 1.0.1</li>
<li>Browser: Chromium</li>
</ul>
<p dir="auto"><strong>Describe the bug</strong></p>
<p dir="auto">When I click on "record at cursor" in one of my tests, the browser is opened but the page never loads. I'm stuck on <code class="notranslate">about:blank</code>.</p>
<details open="" class="details-reset border rounded-2">
  <summary class="px-3 py-2">
    <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-device-camera-video">
    <path d="M16 3.75v8.5a.75.75 0 0 1-1.136.643L11 10.575v.675A1.75 1.75 0 0 1 9.25 13h-7.5A1.75 1.75 0 0 1 0 11.25v-6.5C0 3.784.784 3 1.75 3h7.5c.966 0 1.75.784 1.75 1.75v.675l3.864-2.318A.75.75 0 0 1 16 3.75Zm-6.5 1a.25.25 0 0 0-.25-.25h-7.5a.25.25 0 0 0-.25.25v6.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-6.5ZM11 8.825l3.5 2.1v-5.85l-3.5 2.1Z"></path>
</svg>
    <span aria-label="Video description Enregistrement.de.l.ecran.2022-11-30.a.13.55.24.mov" class="m-1">Enregistrement.de.l.ecran.2022-11-30.a.13.55.24.mov</span>
    <span class="dropdown-caret"></span>
  </summary>

  <video src="https://user-images.githubusercontent.com/1194749/204802738-9e01e524-7776-4cc7-be3d-a5686c7a0618.mov" data-canonical-src="https://user-images.githubusercontent.com/1194749/204802738-9e01e524-7776-4cc7-be3d-a5686c7a0618.mov" controls="controls" muted="muted" class="d-block rounded-bottom-2 border-top width-fit" style="max-height:640px; min-height: 200px">

  </video>
</details>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.36.0-next</li>
<li>Operating System: Ubuntu 22.04</li>
<li>Browser: All</li>
<li>Other info: running the latest docker image mcr.microsoft.com/playwright:v1.36.0-alpha-jun-16-2023, but it also happens in other environments</li>
</ul>
<h3 dir="auto">Source code</h3>
<p dir="auto">Default example suite can be used.</p>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>run the tests in ui mode with a host + port  provided e.g. <code class="notranslate">npx playwright test --ui --ui-host=127.0.0.1 --ui-port=8007</code></li>
<li>using Chrome or firefox browser visit the host + port e.g. <a href="http://127.0.0.1:8007" rel="nofollow">http://127.0.0.1:8007</a> to access the web ui</li>
<li>the path gets redirected to a to the trace view, with a randomly generated hahs identifier in the url. I.e. <code class="notranslate">/trace/uiMode.html?ws=&lt;random hash id&gt;</code></li>
<li>restart the server</li>
<li>visit the root path <code class="notranslate">/</code> again in the browser</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">The web ui should load the (example) tests</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">The ui doesn't load and some errors are thrown in the console.</p>
<p dir="auto">I pinned this down to the redirect <a href="https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/trace/viewer/traceViewer.ts#L128">here</a> using a 301 status code.</p>
<p dir="auto">This means the browser will cache the redirect indefinitely.</p>
<p dir="auto">The effect is that the browser will now keep redirecting to the trace id of the initial run. Which in turn causes an error when the app tries to connect to the ws interface using that stale identifier.</p>
<p dir="auto">Current workaround is to use the browser devtools and disable caching in the network tab, but that is not ideal.</p>
<p dir="auto">Proposed solution is to use a 307 redirect, which would not be cached indefinitely.</p>