16 lines
409 B
JavaScript
16 lines
409 B
JavaScript
export default {
|
|
async fetch(request, env) {
|
|
const url = new URL(request.url);
|
|
|
|
// Redirect www to apex
|
|
if (url.hostname === 'www.mcpengage.com') {
|
|
url.hostname = 'mcpengage.com';
|
|
return Response.redirect(url.toString(), 301);
|
|
}
|
|
|
|
// Let the assets binding handle static files
|
|
// This worker just handles the www redirect
|
|
return env.ASSETS.fetch(request);
|
|
},
|
|
};
|