Parcourir la source

支持预签名

世祺 il y a 11 mois
Parent
commit
ce5c6d4319
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      src/worker.js

+ 4 - 1
src/worker.js

@@ -24,7 +24,10 @@ const globalConfiguration = {
 
 
 async function build_request(request) {
 async function build_request(request) {
 	let dstUrl = new URL(request.url);
 	let dstUrl = new URL(request.url);
-
+	//预签名URL支持
+	if (request.headers.has('signed-url')) {
+		return new Request(request.headers.get('signed-url'));
+	}
 	dstUrl.host = request.headers.has('x-host') ? request.headers.get('x-host') : globalConfiguration.aws_base_url;
 	dstUrl.host = request.headers.has('x-host') ? request.headers.get('x-host') : globalConfiguration.aws_base_url;
 	dstUrl.search = '';
 	dstUrl.search = '';
 	// dstUrl.pathname = url.pathname.substring('/imgprocessingtest'.length)
 	// dstUrl.pathname = url.pathname.substring('/imgprocessingtest'.length)