Azure Service Bus队列是否有CORS设置?

问题描述:

您好,

我正在用javascript编写Web应用程序.我希望能够从浏览器直接向我们的服务总线队列提交消息.我编写了一个用于生成SAS令牌的中间人HTTP API服务器,该服务器使我能够通过HTTP向队列提交权限.这 通过命令行或任何其他用于管理API请求的工具等完成SAS令牌和HTTP请求后,我无法通过浏览器工作,因为我看不到在Azure上任何地方配置CORS设置的方法服务巴士服务.

I'm writing a web application in javascript. I want to be able to submit messages right to our Service Bus queue from the browser. I've written a middle-man HTTP API server for generating SAS tokens that allows me to submit right to the queue via HTTP. The SAS token and HTTP request work when done via command line, or any other tool for managing API requests, etc. I can't get this to work via browser though because I don't see a way to configure CORS settings anywhere on the Azure Service Bus service.

这通常会向我表明我正在解决此错误,并且尽管具有SAS功能,但向浏览器公开此功能也是不明智的. (如果您不尝试允许远程用户访问服务总线,为什么要使用SAS?) 将此提交到我的中间人服务器的服务总线的一部分,并通过那里进行代理?

This would usually suggest to me that I'm going about this wrong and it's not wise to expose this ability right to browsers, despite the SAS feature existing. (Why have SAS if you aren't trying to allow remote users access to the service bus?) Am I supposed to make this submission to service bus part of my middle-man server and proxy through there?

谢谢!

就像您怀疑的那样,通常最好不要直接将其公开给浏览器. SAS是一种可行的方法,对上载尤为有用,而Logic Apps是一个很好的选择.

Like you have suspected, its usually not best to expose this directly to the browser. While SAS is a way to go about, especially useful for working with uploads, Logic Apps is a great candidate for this.

您可以创建一个HTTP触发的逻辑应用程序,该应用程序可以将所需的消息放入服务总线队列中.这样,您就不必编写和维护自己的服务器.

You can create a HTTP triggered Logic App that can place the message that you want in the Service Bus queue. This way, you wouldn't have to write and maintain your own server.

签出此的文档 这里.

Check out the docs for this here.