JS Request cross-domain problem--access-control-allow-origin

Source: Internet
Author: User

Appears during commissioning of the front desk

XMLHttpRequest cannot load http://www.xx.com/Action/Index.php?Action=11. No ' Access-control-allow-origin ' header is present on the requested resource. Origin ' http://blog.xx.com ' is therefore not allowed access.

This time only needs to be added in the HTTP response header

Access-control-allow-origin:http://blog.xx.com


Attention:

Generic domain names, such as *.xx.com, are not supported

Can only be configured as *, or specify a URI

When configuring the specified domain name, you need to add http://https://prefix;

Or is

Access-control-allow-origin:http://www.xx.com,http://blog.xx.com

Otherwise it's

Access-control-allow-origin: *


Nginx Add Method:

Add_header Access-control-allow-origin *;

Haproxy Add Method:

Rspadd access-control-allow-origin:\ *





This article is from "Maple Night" blog, please be sure to keep this source http://fengwan.blog.51cto.com/508652/1892964

JS Request cross-domain problem--access-control-allow-origin

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.