MockServer and the proxy has support for CORS. By default CORS support is enabled for the REST API and disabled for all other requests (such as when expectations are matched).

When CORS support is enabled the following headers are added:

Access-Control-Allow-Origin: "*"
Access-Control-Allow-Methods: "CONNECT, DELETE, GET, HEAD, OPTIONS, POST, PUT, PATCH, TRACE"
Access-Control-Allow-Headers: "Allow, Content-Encoding, Content-Length, Content-Type, ETag, Expires, Last-Modified, Location, Server, Vary"
Access-Control-Expose-Headers: "Allow, Content-Encoding, Content-Length, Content-Type, ETag, Expires, Last-Modified, Location, Server, Vary"
Access-Control-Max-Age: "300"
X-CORS: "MockServer CORS support enabled by default, to disable ConfigurationProperties.enableCORSForAPI(false) or -Dmockserver.enableCORSForAPI=false"

CORS support can be enabled for all enabled for all requests-responses by enabling the enableCORSForAllResponses property.

ConfigurationProperties.enableCORSForAllResponses(true)
java -Dmockserver.enableCORSForAllResponses=true -jar "~/Downloads/mockserver-netty-5.4.1-jar-with-dependencies.jar" -serverPort 1080
var mockserver = require('mockserver-node');
mockserver.start_mockserver({
    serverPort: 1080,
    verbose: true,
    systemProperties: "-Dmockserver.enableCORSForAllResponses=true"
});
}

CORS support is enabled by default for the REST API. CORS support can be disabled the REST API by disabling the enableCORSForAPI property.

ConfigurationProperties.enableCORSForAPI(false)
java -Dmockserver.enableCORSForAPI=false -jar "~/Downloads/mockserver-netty-5.4.1-jar-with-dependencies.jar" -serverPort 1080
var mockserver = require('mockserver-node');
mockserver.start_mockserver({
    serverPort: 1080,
    verbose: true,
    systemProperties: "-Dmockserver.enableCORSForAPI=false"
});
}