2017-05-03 67 views
0

我寫了這樣的服務器:LinkAWS - > S3 - >精細上傳,未能區域回調虛假

我上傳腳本看起來像(的onpage腳本):

var uploader = new qq.s3.FineUploader({ 
     element: document.getElementById("fineUploader"), 
     request: { 
      endpoint: "bucket.s3-eu-central-1.amazonaws.com", 
      accessKey: "accesskey", 
     }, 
     signature: { 
      version: 4, 
      region: "eu-central-1", 
      endpoint: "https:127.0.0.1:8000/s3handler" 
     }, 
     retry: { 
      enableAuto: false 
     }, 
     chunking: { 
      enabled: true 
     }, 
     paste: { 
      targetElement: document, 
      promptForName: true 
     } 
    }); 

我拿到證書,上傳後,我得到的錯誤信息:

the region 'us-east-1' is wrong; expecting 'eu-central-1' 

在節點服務器是x-AMZ-憑證也在區域美國東部返回

vaildkey/vailduntil/us-east-1/s3/aws4_request 

但我已經在客戶端(見第一個代碼)區域添加了簽名。 我也加入到expectedHostname在同一條鏈路的端點上方, 並開始aws.config.region='eu-central-1';

服務器我是怎麼做出錯誤的,該地區沒有變化?

+0

至於解決方法,我在我們區東-1,這種變化之後,它的工作原理創建了第二個桶。但是,錯誤是什麼? – ich

回答

0

%的Fine Uploader docs,你要設置名爲objectProperties包含您所在地區的頂級物業(默認爲us-east-1,這就是爲什麼在該地區工程創建桶)。因此

你上傳腳本應該是這樣的:

var uploader = new qq.s3.FineUploader({ 
    element: document.getElementById("fineUploader"), 
    objectProperties: { 
     region: "eu-central-1" 
    }, 
    request: { 
     endpoint: "bucket.s3-eu-central-1.amazonaws.com", 
     accessKey: "accesskey", 
    }, 
    signature: { 
     version: 4, 
     endpoint: "https:127.0.0.1:8000/s3handler" 
    }, 
    retry: { 
     enableAuto: false 
    }, 
    chunking: { 
     enabled: true 
    }, 
    paste: { 
     targetElement: document, 
     promptForName: true 
    } 
});