mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Create play-api.js
This commit is contained in:
parent
7812da3048
commit
4f09b20f9c
24
website/workers/play-api.js
Normal file
24
website/workers/play-api.js
Normal file
@ -0,0 +1,24 @@
|
||||
addEventListener('fetch', event => {
|
||||
event.respondWith(handleRequest(event.request))
|
||||
})
|
||||
|
||||
async function handleRequest(request) {
|
||||
let url = new URL(request.url);
|
||||
url.hostname = 'play-api.clickhouse.tech';
|
||||
url.port = 8443;
|
||||
url.pathname = url.pathname.replace('/api/', '/');
|
||||
let newHdrs = new Headers()
|
||||
|
||||
const init = {
|
||||
body: request.body,
|
||||
headers: request.headers,
|
||||
method: request.method
|
||||
}
|
||||
|
||||
let response = await fetch(url, init);
|
||||
|
||||
return new Response(response.body, {
|
||||
status: response.status,
|
||||
statusText: response.statusText
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user