使用 fineuploader 的 CORS
CORS using fineuploader
我想使用 fineuploader
跨域。
我收到 Request header field Cache-Control is not allowed by Access-Control-Allow-Headers in preflight response.
错误。
我的 fineuploader 配置是:
request: {
endpoint: "http://api.polskieszlaki.local/4adm/zdjecia/fileupload",
},
cors: {
expected: true,
},
在 .htaccess
我的 apache 服务器上
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
我没有更多的想法让它发挥作用。
问题中引用的消息表明您必须更改 .htaccess
以在 Access-Control-Allow-Headers
响应 header 的值集中设置 Cache-Control
,因为 the Fine Uploader docs表示发送X-Requested-With
header,那么一共需要:
Header set Access-Control-Allow-Headers "Cache-Control, Content-Type, Authorization, X-Requested-With"
MDN docs for the Access-Control-Allow-Headers
response header说明:
The Access-Control-Allow-Headers
header is used in response to a preflight request to indicate which HTTP headers can be used when making the actual request.
我想使用 fineuploader
跨域。
我收到 Request header field Cache-Control is not allowed by Access-Control-Allow-Headers in preflight response.
错误。
我的 fineuploader 配置是:
request: {
endpoint: "http://api.polskieszlaki.local/4adm/zdjecia/fileupload",
},
cors: {
expected: true,
},
在 .htaccess
我的 apache 服务器上
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
我没有更多的想法让它发挥作用。
问题中引用的消息表明您必须更改 .htaccess
以在 Access-Control-Allow-Headers
响应 header 的值集中设置 Cache-Control
,因为 the Fine Uploader docs表示发送X-Requested-With
header,那么一共需要:
Header set Access-Control-Allow-Headers "Cache-Control, Content-Type, Authorization, X-Requested-With"
MDN docs for the Access-Control-Allow-Headers
response header说明:
The
Access-Control-Allow-Headers
header is used in response to a preflight request to indicate which HTTP headers can be used when making the actual request.