Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite page reloads when a index.html (built with adapter-static) is opened as explicit url (www.domain.com/index.html) #13287

Open
sateeshsai opened this issue Jan 8, 2025 · 3 comments · May be fixed by #13296
Labels
bug Something isn't working

Comments

@sateeshsai
Copy link

Describe the bug

Few web servers (like SharePoint) serve few pages with urls that incude the default filename in them, i.e., www.domain.com/index.html instead of www.domain.com.

When hosting index.html file built with adapter-static in such web servers, and opened as www.domain.com/index.html, the page goes into infinite reloads finally throwing the following errors:

  • Too many calls to Location or History APIs within a short timeframe.
  • Uncaught (in promise) DOMException: The operation is insecure.

Reproduction

  • Create a new Sveltekit project
  • Set adapter to adapter-static in svelte.config.js
  • Build and preview the page
  • Add /index.html to the url (e.g., http://localhost:4173/index.html)

Logs

Too many calls to Location or History APIs within a short timeframe. index.html:19:45550
Uncaught (in promise) DOMException: The operation is insecure.
    Ts http://localhost:4173/index.html:19
    ws http://localhost:4173/index.html:19
    Ms http://localhost:4173/index.html:21
    <anonymous> http://localhost:4173/index.html:24
index.html:19
Too many calls to Location or History APIs within a short timeframe. index.html:19:34175
Uncaught (in promise) DOMException: The operation is insecure.
    ws http://localhost:4173/index.html:19
    Ms http://localhost:4173/index.html:21
    <anonymous> http://localhost:4173/index.html:24

System Info

System:
    OS: macOS 15.2
    CPU: (12) arm64 Apple M2 Max
    Memory: 86.55 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - /usr/local/bin/node
    npm: 10.5.2 - /usr/local/bin/npm
    pnpm: 9.0.5 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.205
    Edge: 131.0.2903.112
    Safari: 18.2
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.3.1 
    @sveltejs/adapter-static: ^3.0.8 => 3.0.8 
    @sveltejs/kit: ^2.0.0 => 2.15.1 
    @sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.4 
    svelte: ^5.0.0 => 5.16.5 
    vite: ^5.4.11 => 5.4.11

Severity

blocking all usage of SvelteKit

Additional Information

Unable to use SvelteKit for internal apps because of this issue.

@eltigerchino
Copy link
Member

I can't reproduce the issue given the reproduction steps. Please provide a minimal reproduction.

@sateeshsai
Copy link
Author

sateeshsai commented Jan 8, 2025

Repo here:
https://github.com/sateeshsai/sveltekit-issue-reproduction

build, preview, and access the page with index.html in the url - i.e., http://localhost:4173/index.html and NOT just http://localhost:4173

@eltigerchino eltigerchino added bug Something isn't working and removed awaiting submitter labels Jan 9, 2025
@eltigerchino
Copy link
Member

eltigerchino commented Jan 9, 2025

The infinite refresh seems to happen when building using the hash router, running vite preview, and accessing http://localhost:4173/index.html

import adapter from "@sveltejs/adapter-static";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";

/** @type {import('@sveltejs/kit').Config} */
const config = {
  preprocess: vitePreprocess(),
  kit: {
    adapter: adapter(),
    router: { type: "hash" }
  },
};

export default config;

cc: @dummdidumm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants