1

我需要在 FineUploder 进行的签名调用中添加一些自定义标头。我的 CoffeeScript 看起来像这样:

  options =
    chunking:
      enabled: true
    cors:
      allowXdr: true
    debug:    true
    iframeSupport:
      localBlankPagePath: "/assets/blank.html"
    ios:      false
    multiple: false
    request:
      endpoint:  "..."
      accessKey: "..."
      customHeaders:
        Accept: "application/vnd.keas_web+json;version=4, application/json, text/plain, */*"
        X-Something: "Something"
    resume:
      enabled: true
    retry:
      showButton: true
    signature:
      endpoint: "http://localhost:3001/api/s3/sign"
    uploadSuccess:
      endpoint: "..."
    validation:
      itemLimit: 5
      sizeLimit: 1000000

  $("#uploader").fineUploaderS3(options)

正在调用 signature.endpoint API,但未发送自定义标头。(我不仅在服务器中验证了这一点,还在 Chrome 的网络面板中验证了这一点。)

我是否需要为签名 API 调用与其他调用设置不同的自定义标头?

谢谢!

4

1 回答 1

1

Sending custom headers in Fine Uploader S3 to your signature endpoint is not currently supported. This was requested a week or so ago, and the ability to specify custom headers for all S3-related ajax requests to your local server will be available in Fine Uploader 3.9, which should release in a couple weeks. You can see feature request #956 for more details.

On an unrelated note, there are a few issues with your client-side code:

  1. The customHeaders property of the request option is ignored in Fine Uploader S3 (as you probably figured out already)
  2. Why are you setting allowXdr to "true", but not setting the expected property of the cors option to "true"? If you are working in a cross-origin environment, you must set cors.expected to true as well. In Fine Uploader S3, cors.allowXdr defaults to "true" anyway. If your signature & uploadSuccess servers are on the same domain as the page hosting Fine Uploader, then there is no need to deal with the cors option anyway.
  3. There is no ios option. The camera option has an ios property, that defaults to "false".
于 2013-09-06T15:10:40.523 回答