diff --git a/.changeset/metal-flies-cross.md b/.changeset/metal-flies-cross.md new file mode 100644 index 000000000000..83a72ebc73f3 --- /dev/null +++ b/.changeset/metal-flies-cross.md @@ -0,0 +1,5 @@ +--- +"@cloudflare/workers-shared": patch +--- + +Remove incorrect logic in Asset Worker. diff --git a/packages/workers-shared/asset-worker/src/index.ts b/packages/workers-shared/asset-worker/src/index.ts index 3eb6439596ff..34276e72a82d 100644 --- a/packages/workers-shared/asset-worker/src/index.ts +++ b/packages/workers-shared/asset-worker/src/index.ts @@ -5,10 +5,7 @@ import { Analytics } from "./analytics"; import { AssetsManifest } from "./assets-manifest"; import { applyConfigurationDefaults } from "./configuration"; import { decodePath, getIntent, handleRequest } from "./handler"; -import { - InternalServerErrorResponse, - MethodNotAllowedResponse, -} from "./responses"; +import { InternalServerErrorResponse } from "./responses"; import { getAssetWithMetadataFromKV } from "./utils/kv"; import type { AssetConfig, UnsafePerformanceTimer } from "../../utils/types"; import type { ColoMetadata, Environment, ReadyAnalytics } from "./types"; @@ -117,9 +114,8 @@ export default class extends WorkerEntrypoint { } } - async unstable_canFetch(request: Request): Promise { + async unstable_canFetch(request: Request): Promise { const url = new URL(request.url); - const method = request.method.toUpperCase(); const decodedPathname = decodePath(url.pathname); const intent = await getIntent( decodedPathname, @@ -129,10 +125,6 @@ export default class extends WorkerEntrypoint { }, this.unstable_exists.bind(this) ); - // if asset exists but non GET/HEAD method, 405 - if (intent && ["GET", "HEAD"].includes(method)) { - return new MethodNotAllowedResponse(); - } if (intent === null) { return false; }