To run your react vite application as https://localhost:5173 instead of you can modify the vite.config.js like this:

server: { https: true,host: true },

For Backend like Laravel, be sure to also use the LAN IP instead of the IP Address.

$ php artisan serve --host= --port=80


This is an example of my vite.config.js

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  server: {
    host: 'localhost',
    port: 5173
  plugins: [react()],

This will allow you to access the vite react application from any computer in your local network. In my example, I wanted to access the app from my mobile phone to test the layout of the applicaiton on a cell phone by accessing the compuer's host name or the NAT IP address.

When you make the changes, you may see a message like this on the terminal, therefore, you know its working.

9:57:03 AM [vite] vite.config.js changed, restarting server...
9:57:03 AM [vite] server restarted.

  ➜  Local:   https://localhost:5173/   
  ➜  Network:
  ➜  Network:
  ➜  Network:

More information can be found here: