Skip to content

[Bug] Vite now asks for allowedHosts #631

@matteo-cristino

Description

@matteo-cristino

What happened?

After the bump of vite package to version 5.4.20 deploying behind a url need to have the url set in the vite.config.ts (preview.allowedHosts) file as

export default defineConfig({
    plugins: [
        sveltekit(),
        paraglide({
            project: './project.inlang',
            outdir: './src/paraglide'
        }),
        SvelteKitPWA({
            workbox: {
                maximumFileSizeToCacheInBytes: 5 * 1024 ** 2
            }
        })
    ],
    test: {
        include: ['src/**/*.{test,spec}.{js,ts}']
    },
    preview: {
        allowedHosts: ['wallet.didroom.com']
    }
});

This can be avoided by setting allowedHosts to true that responde to request from any host, but this could lead to DNS rebinding attacks.
Documentation: https://vite.dev/config/preview-options.html#preview-allowedhosts

Steps to reproduce

.

What did you expect to happen?

No response

Severity

🐞 Minor (visual or low-impact)

Environment

No response

Relevant logs or error IDs

No response

Additional context or screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions