[Mingdaoyun] How to solve the cross-domain problem of webhook

【background】

The company introduced Mingdao Cloud, originally intending to take advantage of Mingdao Cloud's integration capabilities, use Mingdao Cloud platform as the back end, keep the front end of the original system, realize communication through Webhook, and finally realize system integration.

【question】

When using webhook directly from the external front-end to communicate with Mingdao Cloud (jquery direct post), a cross-domain problem occurs. Although the back-end action can be triggered, success cannot be returned normally, resulting in the inability to execute all jquery content after the post.

example:

$.post("http://184.41.3.96/api/workflow/hooks/NjQ0N2NmZTczMjYxYjEyMTU5NzA4NDcz",{
    
    "fName":input,"fContent":'{"root":{"data":{"id":"cq6u78fdiqw0","created":1675215125479,"text":"中心主题"},"children":[]},"template":"default","theme":"fresh-blue","version":"1.4.33"}',"fUserName":"{
    
    {user}}"},function(){
    
    
                    						alert("success");
                    					  }
                    			  );

The front end returns the following cross-origin warning:
CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

【plan】

Still can't put your back end on the air, you need to use your back end as a setter.

  1. Post external backend from external frontend;
  2. Post Mingdao Cloud from the external backend;
  3. Feedback external backend from Mingdao Cloud;
  4. Feedback to an external frontend from an external backend;

Guess you like

Origin blog.csdn.net/weixin_41697242/article/details/130391752