Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cmdruid/break-vercel
A simple web project to demonstrate some issues with vercel, CORS, and custom headers.
https://github.com/cmdruid/break-vercel
Last synced: about 1 month ago
JSON representation
A simple web project to demonstrate some issues with vercel, CORS, and custom headers.
- Host: GitHub
- URL: https://github.com/cmdruid/break-vercel
- Owner: cmdruid
- Created: 2023-11-15T20:35:39.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-15T20:37:06.000Z (about 1 year ago)
- Last Synced: 2024-04-18T12:12:03.058Z (8 months ago)
- Language: TypeScript
- Size: 49.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# break vercel (cors)
A simple web project to demonstrate some issues with vercel, CORS, and custom headers.
## Setup
Install dependencies for server.
`yarn install`
Install dependencies for client.
`cd client && yarn install`
## Overview
The `api` folder has a simple endpoint with a recommended cors middleware. This middleware was taken from the following url:
[How can I enable CORS on Vercel?](https://vercel.com/guides/how-to-enable-cors)
You can start the vercel server using `vercel dev`.
> Note: Feel free to add / remove the cors middleware to demonstrate that it is working under normal conditions.
The `client` folder has a basic vite app that uses the `useSWR` package to fetch from the `api` endpoint.
You can start the client app using `cd client && yarn dev`
## Issue
The issue appears to be when a custom key is used in the request header.
Typically, the policy set in the `allowCors` middleware should take effect, however something within the vercel server appears to be rejecting the request before the middleware.