Skip to content

Instantly share code, notes, and snippets.

@nondanee
Last active March 5, 2021 04:48
Show Gist options
  • Save nondanee/2563846095246fd53e2319256caed992 to your computer and use it in GitHub Desktop.
Save nondanee/2563846095246fd53e2319256caed992 to your computer and use it in GitHub Desktop.
Jike CORS Proxy on Cloudflare Worker
addEventListener('fetch', event =>
event.respondWith(handleRequest(event.request))
)
const handleRequest = async request => {
let url = new URL(request.url)
url.host = url.hostname = 'api.jellow.club'
request = new Request(url, request)
if (request.headers.has('origin')) request.headers.delete('origin')
if (request.headers.has('referer')) request.headers.delete('referer')
let response = await fetch(request)
response = new Response(response.body, response)
response.headers.set('access-control-allow-origin', '*')
response.headers.set('access-control-allow-headers', '*')
response.headers.set('access-control-expose-headers', 'x-jike-access-token, x-jike-refresh-token')
return response
}
@quangtuyennguyen
Copy link

quangtuyennguyen commented Mar 5, 2021

Thanks for your code!
But now doesn't work
Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment