Cross-domain access issues under IIS set--access-control-allow-origin site requests across domains

Source: Internet
Author: User

Background: Recently encountered new requirements in the development of the company's OA system to migrate a set of small programs to go

Some feature information is viewed in applet but the file is uploaded on the PC side

For example: Leaders in the office to use the applet to view the Xxxx.pdf file this time encountered problems,

The deployment of the PC side and the deployment of the applet are not on the same server.

Upload files on PC side want applet to see the heart immediately have a program directly access to the PC-side file address Open file is OK,

But everything is not taken for granted ... The applet only supports opening https:xxxxx.com URLs, which means that the PC's URL must be in support of the HTTPS protocol.

However, the web address of the PC can not be changed to support the HTTPS protocol, then the second method is directly on the PC side of the server to upload the disk, note: (I use the Layui upload module front-end directly apply on OK)

It's like this when you finish the test. Hint NO access-control-allow-origin

Decisive Baidu a wave of discovery cross-site requests need to be configured in the IIS Server Access-control-allow-origin tutorial (51496134)

Detailed Introduction (78082585)

Open the IIS Server

Find HTTP response header Open

Add the following two strips

Access-control-allow-headers:content-type, Api_key, Authorization.

Access-control-allow-origin:*.

Restart the server test upload success!

Then the joy of a batch after looking at this * number is worried about Baidu a wave

Use wildcards * to allow all cross-domain access

Then change the * to send the requested domain name over!

Continue to the code .....

Also why the Insert Connection button is gray ....

Cross-domain access issues under IIS set--access-control-allow-origin site requests across domains

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.