Skip to content

Commit

Permalink
Remove local auto-config for proxy since we do not need to run it loc…
Browse files Browse the repository at this point in the history
…ally
  • Loading branch information
ai committed Sep 9, 2024
1 parent 98af220 commit 322eadf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions proxy/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@ import { createProxy, DEFAULT_PROXY_CONFIG } from './index.ts'

const PORT = process.env.PORT ?? 5284

let allowsFrom: string | undefined
if (process.env.NODE_ENV !== 'production') {
allowsFrom = '^http:\\/\\/localhost:5173'
} else if (process.env.STAGING) {
allowsFrom = process.env.PROXY_ORIGIN
}

if (!allowsFrom) {
if (!process.env.PROXY_ORIGIN) {
process.stderr.write(
styleText('red', 'Set PROXY_ORIGIN environment variable\n')
)
process.exit(0)
}

let proxy = createServer(createProxy({ ...DEFAULT_PROXY_CONFIG, allowsFrom }))
let proxy = createServer(
createProxy({ ...DEFAULT_PROXY_CONFIG, allowsFrom: process.env.PROXY_ORIGIN })
)

proxy.listen(PORT, () => {
if (process.env.NODE_ENV !== 'production') {
Expand Down

0 comments on commit 322eadf

Please sign in to comment.