Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

book

Article ID: KB0081352

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON 2.1.0,2.0.0

Description

When the project with BW Rest Service is deployed on the swagger with apache-tomcat server and when we use swaggerUI to call this service, some customer might get below error:

==============
XMLHttpRequest cannot load http://host:port/update/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access.
=============

Issue/Introduction

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

Environment

All Environment

Resolution

This issue might be due to that the Browser such as Chrome or Firefox sends preflight request with OPTIONS methods. But the project is unable to receive the OPTIONS method; or, customer didn't configure access control in the project.

To resolve this, go to your HTTP connection configuration, and make sure you are using HttpCompoment as HTTP Server type as Tomcat is unable to receive OPTIONS method.