我们在vue.js应用程序中使用axios来访问Azure功能.现在我们收到这个错误:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8080' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
我们试图以这种方式在函数中设置响应头:
context.res = {
body: response.data,
headers: {
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Origin': 'http://localhost:8080',
'Access-Control-Allow-Methods': 'GET',
'Access-Control-Request-Headers': 'X-Custom-Header'
}
}
Run Code Online (Sandbox Code Playgroud)
有没有人遇到过这个错误?
我无法让ifModifiedSince工作.这是我的代码:
func updateDatabase()
{
let objectRequest = AWSS3GetObjectRequest()
objectRequest?.key = "wa/wa2016/idahoGmu.tiff"
objectRequest?.bucket = bucketName
let dateComponents = NSDateComponents()
dateComponents.day = 10
dateComponents.month = 4
dateComponents.year = 2018
let date = NSCalendar.current.date(from: dateComponents as DateComponents)
// TODO This isn't working. It grabs the file regardless of date.
objectRequest?.ifModifiedSince = date
let s3 = AWSS3.default()
s3.getObject(objectRequest!).continueWith
{
(task) -> AnyObject! in if let error = task.error
{
print("Error: \(error.localizedDescription)")
}
if let result = task.result
{
let fileManager = FileManager.default
let documents …Run Code Online (Sandbox Code Playgroud)