在cdn中不允许获得问题405方法 [英] Getting issue 405 method not allowed in cdn

查看:352
本文介绍了在cdn中不允许获得问题405方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在使用azure CDN从我的magento商店提供静态连接,但是当我为静态和媒体内容设置cdn url时会遇到CORS和不允许使用405选项方法。

I'm working with azure CDN to serve static connect from my magento store but when i set cdn url for static and media content getting issue of CORS and 405 option method not allowed.

我已在nginx服务器中启用了所有必需的标头,但服务器中仍然没有获取cors标头。

I have enabled all required header in nginx server but still getting cors header is not present in server.

推荐答案

问候,

谢谢 在这里发布。

Thanks  for posting here.

看起来nginx不支持OPTIONS方法。有一个  解决方法 这样可以欺骗nginx提供OPTIONS请求。

It looks like OPTIONS method is not supported in nginx.There is a workaround for this to trick nginx to serve OPTIONS request.

# upload progress
location ^~ /progress {

  if (


request_method = OPTIONS){
add_header Access-Control-Allow-Origin allowed-host。 example.com;
add_header Access-Control-Allow-Methods"GET,OPTIONS";
add_header Access-Control-Allow-Headers"origin,authorization,accept,X-Progress-ID";
add_header Access-Control-Allow-Credentials" true" ;;
add_header Content-Length 0;
add_header Content-Type text / plain;
返回204;
}

add_header Access-Control-Allow-Origin allowed-host.example.com;
add_header'Access-Control-Allow-Credentials''true';

upload_progress_json_output;
report_uploads proxied;
}
request_method = OPTIONS ) { add_header Access-Control-Allow-Origin allowed-host.example.com; add_header Access-Control-Allow-Methods "GET, OPTIONS"; add_header Access-Control-Allow-Headers "origin, authorization, accept, X-Progress-ID"; add_header Access-Control-Allow-Credentials "true"; add_header Content-Length 0; add_header Content-Type text/plain; return 204; } add_header Access-Control-Allow-Origin allowed-host.example.com; add_header 'Access-Control-Allow-Credentials' 'true'; upload_progress_json_output; report_uploads proxied; }

如果您认为自己的问题已得到解答,请点击"标记为已解答"。如果只是帮助点击"投票为有用"。这对阅读此论坛主题的其他社区成员有益。

________________________________________________________________________________

$
祝你好运b
Subhash

If you think your question has been answered click "Mark as Answer" if just helped click "Vote as helpful". This can be beneficial to other community members reading this forum thread.
________________________________________________________________________________

Best regards
Subhash





这篇关于在cdn中不允许获得问题405方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆