-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
react-router@7 & vite@5 + SSL doesn't work #12558
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
Comments
Is it related and worth noting that |
What happens if you set your own I'm using Remix+Vite with SSL myself (with some certs from mkcert) and don't have this issue. If it's helpful, this is my config: import { resolve } from 'path'
import { existsSync, readFileSync } from 'fs'
import { vitePlugin as remix } from '@remix-run/dev'
import { defineConfig } from 'vite'
import tsconfigPaths from 'vite-tsconfig-paths'
const crtPath = resolve(__dirname, 'tls.crt')
const keyPath = resolve(__dirname, 'tls.key')
const httpsOptions = existsSync(crtPath)
? {
cert: readFileSync(crtPath),
key: readFileSync(keyPath)
}
: {}
export default defineConfig({
server: {
port: 1234,
host: 'localhost',
https: httpsOptions
},
plugins: [
remix({
future: {
v3_routeConfig: true,
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
v3_singleFetch: true,
v3_lazyRouteDiscovery: true
}
}),
tsconfigPaths()
]
}) |
@timdorr
Error occurs by adding config to
Just for clarification - this happens ONLY if you try to use react-router. If you init project with https://remix.run/docs/en/main/start/quickstart (just like you seem to have) there is no error and https works |
Thank you @timdorr. I'm having the same problems after following your suggestion and configuring |
FWIW the |
Same issue here when setting the |
This comment has been minimized.
This comment has been minimized.
When HTTPS is enabled, the dev server switches to HTTP/2. This creates H2 psuedo-headers in the request that are currently incompatible with unidici's parsing. This strips out those headers, with special handling for :authority (see RFC 9113: https://www.rfc-editor.org/rfc/rfc9113.html#section-8.3.1-2.3.5). Fixes #12558
Dug into this a bit more. Figured out how to strip out those HTTP/2 pseudo-headers and have the dev server load with an HTTPS config set. Submitted a PR over here: #12830 I tested it locally with my project that I've now converted to RR7 and it works great, AFAICT. In fact, the whole upgrade to RR7 took me only a few minutes, so that's pretty awesome 👍 |
I was finally able to test the new version of
It seems to work until images are loaded. My current setup:
@timdorr, how did you decide which header to remove in https://github.com/remix-run/react-router/pull/12830/files#diff-489c649e7a38f1ca9213711bd588eb3694144b24ad42a1f9b18c75621dbe7cbeR15 ? |
In my project i have a route I now ended up adding a proper proxy configuration in my Nevertheless, thanks for taking care of this issue @timdorr! |
Reproduction
I simply followed the instructions at https://reactrouter.com/start/framework/installation
npx create-react-router@latest my-react-router-app cd my-react-router-app npm i npm run dev
and http://localhost:5173 just works.
Installing and adding
@vitejs/plugin-basic-ssl
tovite.config.js
likeresults in a server error when trying to open https://localhost:5173/:
I checked if the error occurs without React Router by following the instructions at https://vite.dev/guide/#scaffolding-your-first-vite-project
and installing and adding
@vitejs/plugin-basic-ssl
tovite.config.js
like. Result: https://localhost:5173/ does work.
The error does not occur after adding
server.proxy = {}
tovite.config.js
:According to vitejs/vite#4184 this leads to the usage of
HTTP/1.1
.Probably related:
System Info
Used Package Manager
npm
Expected Behavior
Dev server running on HTTPS should work.
Actual Behavior
Dev server running on HTTPS doesn't work.
The text was updated successfully, but these errors were encountered: