跨源资源共享是允许从一个域请求资源并从另一个域进行服务的安全机制。
Vert.x-Web包含一个CorsHandler
为您处理CORS协议的处理程序。
这是一个例子:
router.route().handler(CorsHandler.create("vertx\\.io").allowedMethod(HttpMethod.GET)); router.route().handler(routingContext -> { // Your app handlers });
跨源资源共享是允许从一个域请求资源并从另一个域进行服务的安全机制。
Vert.x-Web包含一个CorsHandler
为您处理CORS协议的处理程序。
这是一个例子:
router.route().handler(CorsHandler.create("vertx\\.io").allowedMethod(HttpMethod.GET)); router.route().handler(routingContext -> { // Your app handlers });