title: SvelteKit on macOS Monterey 12.0.1 (Safari 15.1) - Running on localhost without https but Safari tries to load resources via https
body: <p>Running a local dev server using SvelteKit on macOS Monterey 12.0.1. When opening the dev site in Safari 15.1, I'm getting errors for my images :</p>
  <blockquote>
  <p>Unsafe attempt to load URL
  https://localhost:3000/images/icons/icons.svg from origin
  http://localhost:3000. Domains, protocols and ports must match.
  [Error] Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made. (https://localhost:3000/images/logos/logo.svg, line 0)
  [Error] Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made. (https://localhost:3000/.svelte-kit/dev/runtime/internal/start.js, line 0)
  [Error] Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made. (https://localhost:3000/images/home/home0.jpg, line 0)</p>
  </blockquote>
  <ol>
  <li>I'm accessing the site via http://localhost:3000 - not https://localhost.</li>
  <li>There's no <strong>base</strong> element and all images use a relative href (<code>/images/icons/icons.svg</code>).</li>
  <li>I checked window.location.protocol in Safari's console and it confirmed &quot;http:&quot; (also, window.location.origin = &quot;http://localhost:3000&quot;).</li>
  <li>Problem does not happen with Chrome or FireFox (latest versions).</li>
  </ol>
  <p>Googled for suggestions and found advice to delete cookies, local storage and databases in Safari for localhost (which I tried though localhosts did not disappear from the list and now says &quot;Databases&quot;).
  <a href="https://i.stack.imgur.com/SK14G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SK14G.png" alt="enter image description here" /></a></p>
  <p>I also found a recommendation to quite Safari then run the following shell commands:</p>
  <pre><code>killall nsurlstoraged
  rm -f ~/Library/Cookies/HSTS.plist
  launchctl start /System/Library/LaunchAgents/com.apple.nsurlstoraged.plist
  </code></pre>
  <p>None of that appears to apply to Monterey.</p>
  <p>Any thoughts about what I need to do other than <code>npm run dev --https --open</code> (which works but...)?</p>
  <p>It may have been related to my Monterey upgrade. I didn't notice because I have been working in https mode lately.</p>
  <p>For SvelteKit folks, I did <code>rm -rf .svelte-kit</code> before <code>npm run dev --open</code></p>