zoukankan      html  css  js  c++  java
  • angular跨域访问的问题

    CORS跨域资源共享

    跨域资源共享(CORS )是一种网络浏览器的技术规范,它为Web服务器定义了一种方式,允许网页从不同的域访问其资源。

    Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers"); 
        if (responseHeaders == null) { 
            responseHeaders = new Form(); 
            getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders); 
        } 
        responseHeaders.add("Access-Control-Allow-Origin", "*"); 
        responseHeaders.add("Access-Control-Allow-Methods", "POST,OPTIONS");
        responseHeaders.add("Access-Control-Allow-Headers", "Content-Type"); 
        responseHeaders.add("Access-Control-Allow-Credentials", "false"); 
        responseHeaders.add("Access-Control-Max-Age", "60");

    红色是关键

    在chrome  firefox 等浏览器可以,但是IE8不支持。

  • 相关阅读:
    analysis of algorithms
    Measurement of Reflected Radiation
    lecture 5
    lecture 3
    字符串
    Emission of Radiation辐射发射
    Electromagnetic Radiation(EMR) 电磁辐射
    Linux FTP服务器-VSFTPD虚拟用户配置
    jenkins notes
    python nose使用记录
  • 原文地址:https://www.cnblogs.com/tongdengquan/p/6090520.html
Copyright © 2011-2022 走看看