#astro dev server HTTP 2

12 messages · Page 1 of 1 (latest)

pseudo sundial
#

Hi, is there a way to use astro with something like @vitejs/plugin-basic-ssl to enable http 2 requests while developing?

lament osprey
pseudo sundial
#

Yep, I though so too but it doesn't work. Here is a minimal reproduction repository https://github.com/alexvuka1/astro-http2. Feel free to pull it and run the commands in the readme. Unfortunately, the curl prints 1.1 and not 2, which is what I need for the file streaming to work

glass rain
pseudo sundial
#

Shouldn't be needed when using @vitejs/plugin-basic-ssl. I have tried creating a similar repository using vite without astro where this is my vite.config.ts

import viteBasicSslPlugin from '@vitejs/plugin-basic-ssl'
import { defineConfig } from 'vite'
import solid from 'vite-plugin-solid'

export default defineConfig({
  plugins: [solid(), viteBasicSslPlugin()],
})

and it works, i.e. the curl command prints 2. Hence I suspect it is something to do with astro dev

glass rain
#

Sorry, I stepped away for a bit
I found out that we're setting the vite.server.proxy internally, which causes http/2 to be disabled according to the note on the link.

#

Setting vite.server.proxy to false in the astro config should fix it I think

pseudo sundial
#

Yeah that fixes it. Thank you!

glass rain
#

Awesome! Feel free to open an issue so we can track this bug, it should ideally work by default

gray onyxBOT
#

Ouch. Guess it's time to squash some bugs.

Please open an issue on the withastro/astro repo.

pseudo sundial
#

An issue I have since noticed is that setting proxy: false makes it so that Astro.request.url: https://undefined/. @glass rain do you have an idea as to why that might be happening?

glass rain
#

Not sure but that looks like a bug, I recommend opening an issue