-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Https dev server locks mobile Safari in infinite redirect loop #2337
Comments
I think #1992 will fix this |
Can confirm this is still an issue @ Here's my import { defineConfig, PluginOption, ViteDevServer } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import reactRefresh from '@vitejs/plugin-react-refresh';
import replace from '@rollup/plugin-replace';
import { config as loadEnvironment } from 'dotenv';
loadEnvironment();
export default defineConfig({
build: {
outDir: __dirname + '/dist',
// Keep the /dist folder clean by purging it before each compilation
emptyOutDir: true,
},
publicDir: '../public',
root: 'src',
plugins: [
// enable hmr for react components
reactRefresh(),
// resolve tsconfig paths
tsconfigPaths({ root: __dirname }),
// replace node env vars with import.meta env vars
replace({
'process.env.VITE_USE_MSW': 'import.meta.env.VITE_USE_MSW',
preventAssignment: true,
}) as PluginOption,
],
esbuild: {
// esbuild does not transpile React 17 style yet, so we just add an import
// statement everywhere automatically.
// https://github.com/evanw/esbuild/issues/334
jsxInject: "import React from 'react'",
},
server: {
port: 4000,
host: '0.0.0.0',
https: true,
proxy: {
'^/api/.*': {
target: process.env.VITE_API_URL,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
secure: false,
},
},
},
}); Unfortunately I can't do any sort of debugging, because the Safari inspector doesn't show any activity while the loop is occurring. |
Also can confirm, this was NOT fixed by #1992 |
Here's a workaround (Mac specific instructions):
{
// ... your other config ...
server: {
https: {
key: './key.pem',
cert: './cert.pem',
},
host: '0.0.0.0',
}
}
You should now be able to view your local app by entering your local IP in safari, i.e. |
@speigg were you using a self signed SSL cert? |
@airhorns yes |
It happens to asp.net core web as well. |
I confirmed this still happens. |
I can't reproduce this with iOS 15.5. Connecting the web inspector to macos didn't show anything different. My repro is: pnpm create vite vite-ios-https
cd vite-ios-https
pnpm i
pnpm update vite@beta
pnpm dev --host --https
# then visit the network url on mobile |
Still reproducible on IOS 14.8.1 |
Closing as I believe #9007 will fix this. |
Describe the bug
Using https causes infinite redirecting behaviour in iOS Safari
Reproduction
System Info
vite
version: 2.0.4Logs (Optional if provided reproduction)
yarn dev
using httpsThe text was updated successfully, but these errors were encountered: