Skip to content
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

🐛 BUG: In DEV HTTPS Vite config isn't reflected in the dev server instance #2188

Closed
vampaz opened this issue Dec 11, 2021 · 2 comments
Closed

Comments

@vampaz
Copy link

vampaz commented Dec 11, 2021

What version of astro are you using?

0.21.12

What package manager are you using?

npm

What operating system are you using?

Mac, Linux

Describe the Bug

When setting the Vite server config as HTTPS the config isn't used.

astro.config.mjs:

import * as fs from 'fs';

export default {
  renderers: ['@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
  vite: {
    server: {
      https: {
        key: fs.readFileSync('./.cert/key.pem', 'utf8'),
        cert: fs.readFileSync('./.cert/cert.pem', 'utf8'),
      },
    },
    plugins: [],
  },
};

CLI logs:
05:56 PM [astro] Server started 324ms 05:56 PM [astro] Local: http://localhost:3000/

And the Astro server is only available in HTTP.

It would be expected to have the Vite config reflected in the server. From a quick look, it seems that Astro always starts an HTTP server and proxies it to Vite.

Probable solution:
Check if the Vite config includes HTTPS when starting the server in

Link to Minimal Reproducible Example

Dev server related, can't reproduce here

@natemoo-re
Copy link
Member

This seems reasonable to support, but we'd likely need to vendor Vite's HTTP server logic, which could get out of sync. https://github.com/vitejs/vite/blob/211f183ffd747e870f769cd1e3f24baab9c1b555/packages/vite/src/node/http.ts

@tony-sull
Copy link
Contributor

Support for this landed recently with PR #2494 🥳 Astro now uses vite's built-in server and should use these server settings now 👍

PR #2494
Related RFC discussion: withastro/roadmap#80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants