new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vite · Config reference · all subjects

server options: proxy & headers

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

server.proxy type and behavior

The server.proxy option is of type 'Record<string, string | ProxyOptions>'. It configures custom proxy rules for the dev server as an object of key-value pairs. Any requests whose path starts with that key will be proxied to the specified target. If the key starts with '^', it will be interpreted as a RegExp. Extends http-proxy-3.

server.cors type and default

The server.cors option is of type 'boolean | CorsOptions' with a default value of { origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/ } which allows localhost, 127.0.0.1 and ::1. It configures CORS for the dev server.

server.headers type

The server.headers option is of type 'OutgoingHttpHeaders'. It specifies server response headers.

server.proxy with string shorthand example

Example showing string shorthand syntax for server.proxy: '/foo': 'http://localhost:4567' proxies requests from http://localhost:5173/foo to http://localhost:4567/foo

server.proxy with options and rewrite example

Example showing server.proxy with options: '/api': { target: 'http://jsonplaceholder.typicode.com', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') } proxies http://localhost:5173/api/bar to http://jsonplaceholder.typicode.com/bar

server.proxy with RegExp example

Example showing server.proxy with RegExp: '^/fallback/.*': { target: 'http://jsonplaceholder.typicode.com', changeOrigin: true, rewrite: (path) => path.replace(/^\/fallback/, '') } proxies http://localhost:5173/fallback/ to http://jsonplaceholder.typicode.com/

server.proxy with WebSocket example

Example showing server.proxy for WebSocket: '/socket.io': { target: 'ws://localhost:5174', ws: true, rewriteWsOrigin: true } proxies ws://localhost:5173/socket.io to ws://localhost:5174/socket.io

Give your agent this brain