Skip to content

Commit

Permalink
fix(worker): redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jul 23, 2024
1 parent 3682f7d commit 5ac13d1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ app.use('*', prettyJSON());

app.get('/', async (c) => {
return c.json({
message: 'AnimeGarden - 動漫花園 3-rd party mirror site',
message: 'AnimeGarden - 動漫花園 3-rd party mirror site'
});
});

Expand All @@ -37,8 +37,9 @@ app.onError((err, c) => {

export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
const destinationURL = "https://garden.breadio.wiki";
const destinationURL = new URL(request.url);
destinationURL.host = 'garden.breadio.wiki';
const statusCode = 301;
return Response.redirect(destinationURL, statusCode);
},
return Response.redirect(destinationURL.toString(), statusCode);
}
};

0 comments on commit 5ac13d1

Please sign in to comment.