Skip to content

Commit

Permalink
Merge pull request #10 from Asvin1/master
Browse files Browse the repository at this point in the history
Added cloudflare worker
  • Loading branch information
Asvin1 authored Oct 5, 2023
2 parents 7d1bc58 + db4fc7b commit e9ca84f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
async fetch(request) {
async function MethodNotAllowed(request) {
return new Response(`Method ${request.method} not allowed.`, {
status: 405,
headers: {
Allow: "GET",
},
});
}
// Only GET requests work with this proxy.
if (request.method !== "GET") return MethodNotAllowed(request);
var uri=request.url.substring((request.url.toString()).lastIndexOf('.dev') + 5)
return fetch(uri);
},
};

0 comments on commit e9ca84f

Please sign in to comment.