使用FineUploader和可选的https吗? [英] Using FineUploader with optional https?

查看:71
本文介绍了使用FineUploader和可选的https吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上设置了FineUploader,并添加了一个复选框,该复选框允许用户根据需要使用HTTPS上传文件。

I have setup FineUploader on a site and I included a check box that allows users to upload files using HTTPS if the want to.

不幸的是,如果用户使用http访问该网站,然后尝试使用ssl,则会出错,我认为是由于CORS问题。我认为这是一个CORS问题,因为如果我使用https访问网站并尝试使用ssl进行上传,则可以正常工作。

Unfortunately if the user accesses the site using http and then tries to use ssl it errors out, I assume because of CORS issues. I assume it is a CORS issue because if I access the site using https and try to upload using ssl it works fine.

我发现有关启用CORS支持的一些文档,但是您似乎需要这样一来,只会发出CORS要求,也不会发出任何要求。在我的情况下,有时会要求CORS,而有时不会。

I found some documentation about enabling CORS support, but it appears that you either need to make it so only CORS requests will be made or none will be made. In my situation there will be CORS request some times and not others.

有人知道为此有一个好的解决方法吗?单击复选框时,是否应该使用HTTPS重新加载整个页面?

Does anyone know of a good work around for this? Should I just reload the entire page using HTTPS when the checkbox is clicked?

推荐答案

只是重申我在我的文章中提到的内容注释(这样其他人可以很容易地看到这一点)...

Just to reiterate what I've mentioned in my comments (so others can easily see this)...

也许您可以在用户选择HTTP或HTTPS作为上传协议后实例化Fine Uploader。如果需要,可以通过 cors 选项的 expected 属性启用CORS功能。请记住,在处理CORS请求时,必须在服务器端处理一些细节,尤其是在涉及IE9或更旧版本的情况下。请参阅我在CORS功能上的博客文章有关更多详细信息。

Perhaps you can instantiate Fine Uploader after the user selects HTTP or HTTPS as a protocol for uploads. If you must, you can enabled the CORS feature via the expected property of the cors option. Keep in mind that there are some details server-side you must address when handling CORS requests, especially if IE9 or older is involved. Please see my blog post on the CORS feature for more details.

这篇关于使用FineUploader和可选的https吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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