All Products
Search
Document Center

REST CrossOrigin

Last Updated: Aug 17, 2020

We provide a built-in cross-origion Filter class for the RESTful service. There are 2 configuration options as follows:

  • SOFARPC API: To use the SOFARPC API, you can add a parameter in ServerConfig to indicate that the method is set to SOFARPC API.
    1. Map<String,String> parameters=new HashMap<String, String>()
    2. parameters.put(RpcConstants.ALLOWED_ORIGINS,"abc.com,cdf.com");
    3. serverConfig.setParameters(parameters);
  • XML: In the XML mode, configure as follows:
    1. com.alipay.sofa.rpc.rest.allowed.origins=a.com,b.com