Comments, appointments adjustments, fixed some issues
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
//Backend URL, falls back to localhost for local development
|
||||
const BACKEND = process.env.BACKEND_URL || 'http://localhost:8080'
|
||||
|
||||
//Forwards all incoming requests to the backend, preserving method, headers, and body
|
||||
async function proxy(request, { params }) {
|
||||
const path = (await params).path.join('/')
|
||||
const { search } = new URL(request.url)
|
||||
@@ -10,6 +12,8 @@ async function proxy(request, { params }) {
|
||||
headers.delete('origin')
|
||||
|
||||
const init = { method: request.method, headers }
|
||||
|
||||
//Only attach a body for requests that can have one
|
||||
if (!['GET', 'HEAD'].includes(request.method)) {
|
||||
init.body = request.body
|
||||
init.duplex = 'half'
|
||||
|
||||
Reference in New Issue
Block a user