Https on Localhost for Vite and React , Vue , Vanila , Svelte

  Рет қаралды 10,518

benixal

benixal

Жыл бұрын

self-signed and valid SSL certificate for development on localhost
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate.crt
00:00:23 create new react app
00:01:29 enable self-signed SSL
00:07:12 enable Valid SSL

Пікірлер: 39
@Adrian-oo1rz
@Adrian-oo1rz 9 ай бұрын
I've looking for this months. Thanks, you've helped me a lot!
@benixal
@benixal 9 ай бұрын
Glad it helped. You are welcome!
@76Freeman
@76Freeman Жыл бұрын
Thanks for the explanations :) very clear and easy to follow instructions
@benixal
@benixal Жыл бұрын
Thanks for taking the time to watch the video , Glad to hear it was helpful!
@FlorianGoussin
@FlorianGoussin Жыл бұрын
Wow! This is amazing! I need to use the Geolocation API, but looks like that now you need a secure context, so I hope this is what I need. 'Gonna test that very soon! Thx!
@FlorianGoussin
@FlorianGoussin Жыл бұрын
Yeah that works now. Additionally specifically to my project I had to do the same with my local backend server (I use hypercorn) and of course not forget to allow the location service on my phone for the phone browser where I'm testing.
@benixal
@benixal Жыл бұрын
Glad it worked! Thanks for sharing
@treeworldnight3700
@treeworldnight3700 Жыл бұрын
Thanks a lott, You help me very muchh!!
@benixal
@benixal Жыл бұрын
Thanks for your comment! The domain name in the /etc/hosts file is a custom name you choose for your local development (It's not a real domain on the internet) . You can use any name you like, even without an extension, such as 'myvueapp', 'myfakedomain', or even a fake extension like 'domain123.fake'. Just make sure it doesn't conflict with existing domain names. In your case, using your project name followed by .ben worked because it's a custom domain extension for local testing.
@EgorDemeshko
@EgorDemeshko 9 ай бұрын
greate video. thanks,
@benixal
@benixal 9 ай бұрын
Glad it helped. You are welcome!
@thespecsofscience2051
@thespecsofscience2051 6 ай бұрын
Thanks a lot broooooo
@benixal
@benixal 6 ай бұрын
You're welcome! 🚀
@thedelanyo
@thedelanyo 5 ай бұрын
This is great and helpful, but one more thing, will it work without a custom domain for the localhost?
@benixal
@benixal 5 ай бұрын
Thanks for your comment, you're welcome, yes It should.
@javerialodhi
@javerialodhi 2 ай бұрын
Sir I do not create the vite project, how to apply in simple react project?
@ariel795
@ariel795 3 ай бұрын
And if I have a private IP address ? Should I be able to bind the IP to the domain ?
@benixal
@benixal 3 ай бұрын
Yes, you can bind a domain name to a private IP address, but it will only be accessible within the same private network.
@pnemonick
@pnemonick Жыл бұрын
Can I use this method to have https/secure connection on my domain (not only on localhost)?
@benixal
@benixal Жыл бұрын
Absolutely! At 00:07:12 in the video, I discuss how you can have a secure HTTPS connection on your domain as well, not just on localhost.
@naufalnasrullah6965
@naufalnasrullah6965 10 ай бұрын
how to use https on next js?
@guiaflutterflow
@guiaflutterflow 9 ай бұрын
and Next.js??
@alex_borisovic
@alex_borisovic 19 күн бұрын
At react you can create. env file with line https: true. That's all
@damilare83
@damilare83 10 ай бұрын
@benixal what could this mean net::ERR_CERT_COMMON_NAME_INVALID i'm getting that error in my developer console. I'm trying to load up my react page using vite over a laravel project and the certificate is valid for the server but when it gets to the vite part it say net::ERR_CERT_COMMON_NAME_INVALID in the console
@benixal
@benixal 10 ай бұрын
If you are using a valid SSL certificate: Check the domain name you open in the browser, which should match the certificate. For instance, if your certificate is only for the main domain (example.com), it won't work for (www.example.com). If you are using a self-signed SSL certificate: For Chrome: Click on 'Advanced' and then choose 'Proceed to localhost (unsafe)' For Firefox: Click on 'Advanced' and then select 'Accept the Risk and Continue'
@damilare83
@damilare83 10 ай бұрын
Thank you for responding. I've made the necessary adjustments but i get net::ERR_CONNECTION_REFUSED in the console now. What could that mean? @@benixal
@benixal
@benixal 10 ай бұрын
Double-check the port number. ERR_CONNECTION_REFUSED often happens due to an incorrect port entry. When starting, Vite typically auto-adjusts to the next available port if the specified one is occupied. Keep an eye on your terminal or CMD to see which port Vite is using.
@fracttal5
@fracttal5 10 ай бұрын
Doesn't work for me, still getting "Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR"
@benixal
@benixal 10 ай бұрын
self-signed or valid ?
@fracttal5
@fracttal5 10 ай бұрын
@@benixal It's self-signed, I'm on Linux just like you, trying it on a local React with Vite project, using fetch API.
@benixal
@benixal 10 ай бұрын
try this to generate your certificate : openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out cert.crt
@fracttal5
@fracttal5 10 ай бұрын
@@benixal Mhhm, now I'm getting NET::ERR_CERT_AUTHORITY_INVALID, do I need to go for the valid certificate route? I'm trying to fetch data from a fake API with a JSON file.
@benixal
@benixal 10 ай бұрын
Done .. The 'ERR_CERT_AUTHORITY_INVALID' error you encountered is because the SSL certificate is self-signed For Chrome: Click on 'Advanced' and then choose 'Proceed to localhost (unsafe)' For Firefox: Click on 'Advanced' and then select 'Accept the Risk and Continue' If the API is giving you errors, consider using a valid SSL certificate. Self-signed certificates might not work with some APIs due to stricter security requirements.
How to create a valid self signed SSL Certificate?
25:01
Christian Lempa
Рет қаралды 342 М.
Create React App vs. NextJS vs. Vite
15:40
PedroTech
Рет қаралды 68 М.
你们会选择哪一辆呢#short #angel #clown
00:20
Super Beauty team
Рет қаралды 46 МЛН
Me: Don't cross there's cars coming
00:16
LOL
Рет қаралды 15 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 2,3 МЛН
Final muy increíble 😱
00:46
Juan De Dios Pantoja 2
Рет қаралды 53 МЛН
HTTPS, SSL, TLS & Certificate Authority Explained
43:29
Laith Academy
Рет қаралды 73 М.
Coding Shorts: Using the Vite PWA Plug-in
14:05
Shawn Wildermuth
Рет қаралды 24 М.
Quick and Easy Local SSL Certificates for Your Homelab!
12:08
Wolfgang's Channel
Рет қаралды 707 М.
Настраиваем create-react-app: HTTPS, SSL, PROXY, SCSS, немного про DEPLOY
31:27
Елена Литвинова — Искусство Веб-разработки 🛸
Рет қаралды 8 М.
Coding Shorts: Building with Vite - Customizing Production Builds
10:44
Shawn Wildermuth
Рет қаралды 17 М.
How to Expose Local Host using Cloudflare Tunnels?
24:34
Piyush Garg
Рет қаралды 25 М.
Create Your Own SSL Certificate Authority (Windows)
7:09
Delicious Brains
Рет қаралды 36 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
你们会选择哪一辆呢#short #angel #clown
00:20
Super Beauty team
Рет қаралды 46 МЛН