在nginx.conf中配置
http { ...... add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X-Requested-With; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; ...... }
|
這樣就可以實現(xiàn)GET,POST,OPTIONS的跨域請求的支持
也可以 add_header Access-Control-Allow-Origin http://test.51testing.com; --指定允許的url;
配置項詳細(xì)解釋:
w3c-Cross-Origin Resource Sharing
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點擊舉報。