itch icon indicating copy to clipboard operation
itch copied to clipboard

Installed browser game not having correctly header applied for brotli header

Open leafo opened this issue 1 year ago • 1 comments

game: https://3di70r.itch.io/crusty-proto

image

leafo avatar Dec 13 '24 01:12 leafo

You may use the following script to serve them:

#!/usr/bin/env bun

Bun.serve({
  port: 3000,
  async fetch(req) {
    const url = new URL(req.url)
    const path = url.pathname === "/" ? "/index.html" : url.pathname
    return new Response(Bun.file("." + path), { 
      headers: path.endsWith(".br") ? { 
        "Content-Encoding": "br", 
        "Content-Type": path.endsWith(".js.br") ? "application/javascript" 
          : path.endsWith(".wasm.br") ? "application/wasm" 
          : "application/octet-stream"
      } : undefined 
    })
  },
})

console.log("✅ http://localhost:3000")
Bun.spawn(["cmd", "/c", "start", "http://localhost:3000"])

Dimava avatar Nov 15 '25 23:11 Dimava