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

Suggestion: Support natively Laravel vite TLS #395

Open
cbaconnier opened this issue Nov 3, 2022 · 3 comments
Open

Suggestion: Support natively Laravel vite TLS #395

cbaconnier opened this issue Nov 3, 2022 · 3 comments

Comments

@cbaconnier
Copy link

cbaconnier commented Nov 3, 2022

The current version (2.2.36) does not support natively Laravel Vite TLS.

  • Laravel Vite looks for the certificates in the folder ~/.config/valet/Certificates/ and this path is hardcoded
  • Valet Linux store the certificates in the folder ~/.valet/Certificates/ and this path is hardcoded

In order to make this works, I see two possibilities or two workaround:

  1. Valet Linux should support both paths
  2. Laravel Vite should support both paths

Workaround: Make a symlink 😊

ln -s ~/.valet ~/.config/valet

Edit:
An another workaround would be to use a bunch of configuration on each projects

import fs from 'fs'; 
 
const host = 'my-app.test'; 
 
export default defineConfig({
    // ...
    server: { 
        host, 
        hmr: { host }, 
        https: { 
            key: fs.readFileSync(`/path/to/${host}.key`), 
            cert: fs.readFileSync(`/path/to/${host}.crt`), 
        }, 
    }, 
});
@cbaconnier cbaconnier changed the title Suggestion: Support Laravel vite TLS Suggestion: Support Laravel natively vite TLS Nov 3, 2022
@cbaconnier cbaconnier changed the title Suggestion: Support Laravel natively vite TLS Suggestion: Support natively Laravel vite TLS Nov 3, 2022
@Adesin-fr
Copy link
Collaborator

An another workaround would be to use a bunch of configuration on each projects

For sure this workaround is very anoying, and I can't imagine this being a good solution ;)

The symlink could be an easy and quick (and dirty !) solution, but I'm not a big fan of symlinks : Changing valet's configuration should be easy enough.

Just a warning about this : before changing it, on valet's upgrade , we must make sure that we will also copy the conf to the new location !

@ru44
Copy link

ru44 commented Mar 9, 2023

The workaround you suggested of creating a symbolic link could work, as it would make Laravel Vite find the certificates in the correct folder. However, this may not be the most elegant solution and could potentially cause issues if other applications depend on the ~/.config/valet/Certificates/ path.

A better solution would be to modify the Laravel Vite configuration to allow for both paths. You could submit a pull request to the Laravel Vite repository on GitHub to add this functionality, or you could modify your own local copy of the Laravel Vite code.

Another option, as you mentioned, would be to specify the path to the certificates in each project's configuration. This would allow you to use the correct path for each project, but would require more setup for each individual project.

@Vethavear
Copy link

Vethavear commented Mar 29, 2023

That would be great. Workaround with symlink indeed works, many thanks for that. I swapped from macOS to Linux and this was last part I needed to make it work!

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

4 participants