REST cross-domain access

更新时间:
复制 MD 格式

SOFARPC provides a built-in cross-domain filter to enable cross-domain access for REST.

SOFARPC API method

To enable cross-domain access with the SOFARPC API, add the following parameters to ServerConfig.

Map<String,String> parameters=new HashMap<String,String>()
parameters.put(RpcConstants.ALLOWED_ORIGINS,"abc.com,cdf.com");
serverConfig.setParameters(parameters);

XML method

For the XML method, use the following configuration.

com.alipay.sofa.rpc.rest.allowed.origins=a.com,b.com