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.
Map<String,String> parameters=new HashMap<String, String>()
parameters.put(RpcConstants.ALLOWED_ORIGINS,"abc.com,cdf.com");
serverConfig.setParameters(parameters);
- XML: In the XML mode, configure as follows:
com.alipay.sofa.rpc.rest.allowed.origins=a.com,b.com