solidjs / solid-start

SolidStart, the Solid app framework
https://start.solidjs.com
MIT License
4.93k stars 371 forks source link

[Bug?]: "official" HTTPs support #1546

Closed slainless closed 1 week ago

slainless commented 1 week ago

Duplicates

Latest version

Current behavior 😯

Well, I don't know if this falls into feature request category or bug so forgive me if I'm using the wrong type of issue.

Just like #139 , all we really know is how to configure https with pure Vite environment. Sadly, Vite's server.https doesn't work with current/latest solid start setup. While it's possible to mitigate or work around this using reverse proxy, IMHO, It's more preferable if official framework support this, just like when working in Vite.

Is there a way to configure local development server to use HTTPs? If not, will local HTTPs feature be implemented/supported in the future?

Thanks.

Expected behavior 🤔

A working dev server using secured HTTP

Steps to reproduce 🕹

Steps if following vite https recommendation:

  1. Install basic ssl plugin such as @vite/plugin-basic-ssl or vite-plugin-mkcert
  2. Setup the plugin
  3. Access dev with https protocol
  4. Browser show ssl error/misconfigured ssl

Context 🔦

I'm trying to develop/use feature which are strictly blocked by server when using non-secure context (for example, Worker).

Your environment 🌎

- OS: Windows
- Browser: Chrome
- @solid/start: v1.0.0
- vinxi: 0.3.11
Brendonovich commented 1 week ago

Here's a solution I posted in discord

import { defineConfig } from "@solidjs/start/config";
import mkcert from "vite-plugin-mkcert";

export default defineConfig({
  ssr: true,
  vite: {
    server: { https: true },
    plugins: [
      mkcert({
        force: true,
        savePath: "./certs",
      }),
    ],
  },
//  run once with this commented out, then leave it uncommented all other times
//  server: {
//    https: {
//      cert: "./certs/cert.pem",
//      key: "./certs/dev.pem",
//    },
//  },
});
slainless commented 1 week ago

@Brendonovich Ah thanks, didn't know that it's already supported in vinxi instead.

But well, in my defense, vinxi server.https is currently untyped and I just realized I already look at https://github.com/nksaraf/vinxi/issues/307 but I don't even bother reading the issue content, thinking its unrelated, I'm so dumb 💀.

Anyway, thanks for your help, both here and there :D