Skip to content

Using @vitejs/plugin-basic-ssl with InertiaJS #728

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

Open
jqr91 opened this issue Apr 15, 2025 · 3 comments
Open

Using @vitejs/plugin-basic-ssl with InertiaJS #728

jqr91 opened this issue Apr 15, 2025 · 3 comments

Comments

@jqr91
Copy link

jqr91 commented Apr 15, 2025

It's possible to use vite SSL with InertiaJS? I need to develop my application for integrate with many sandbox payments and require a https.

This is my configuration:

const host = '127.0.0.1';
const port = '8000';
export default defineConfig({
    plugins: [
        react(),
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
        basicSsl()
    ],
    resolve: {
        alias: {
            'ziggy-js': path.resolve('vendor/tightenco/ziggy'),
            "@": "/resources/js/Pages/src",
            "@layout": "/resources/js/Pages/layout"
        },
    },
    server: {
        // 005 enabling the HTTPS
        https: true,
        // 006 setting the proxy with Laravel as target (origin)
        proxy: {
            '^(?!(\/\@vite|\/resources|\/node_modules))': {
                target: `http://${host}:${port}`,
            }
        },
        host,
        port: 5173,
        // 007 be sure that you have the Hot Module Replacement
        hmr: { host },
    }
});

But in localhost pointing to https://localhost:5173 i have this error in console

Image

Any solutions?
Thanks

@RobertBoes
Copy link
Contributor

Seems you're using Laravel, this functionality is built-in: https://laravel.com/docs/12.x/vite#working-with-a-secure-development-server

@jqr91
Copy link
Author

jqr91 commented Apr 15, 2025

@RobertBoes i dont use Laravel heard or laravel valet, but i'm using directly artisan cli with "php artisan serve". Now for this reason i have installed @vitejs/plugin-basic-ssl plugin. Where am I going wrong? Maybe inertia is not compatible with this system?

@RobertBoes
Copy link
Contributor

@jqr91 Think you'll need to remove the entire server part, as I'd assume basicSsl would take care of setting that up. As is also mentioned in the Laravel docs, if you use that plugin, you'd first need to visit the URL from the Vite dev server, to accept the certificate in your browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants