Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
I have already configure my Tomcat serve for CORS still i am not able to access my api and i am getting " Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."
When i am trying to access the API using Postman i am getting 403 error.
For reference please check attached images.
Solved! Go to Solution.
hii Sharon,
we have followed https://www.ptc.com/en/support/article/CS229450 article that resolved our issue.
Thanks and Regards,
Shubham
Hi @shubhamm.
Have you made any changes to filter for CORS based on any documentation PTC provides? If so, please provide specifics on the changes that were made.
What versions of Tomcat/ThingWorx are you running?
Here is an article that may help depending on the ThingWorx version you're running.
Regards.
--Sharon
Tomcat 8.5.32
Thinworx 8.3
Hi @shubhamm.
Have you made any changes to filter for CORS based on any documentation PTC provides? If so, please provide specifics on the changes.
Was the article I provided helpful?
Regards.
--Sharon
<filter> <filter-name>CorsFilter</filter-name> <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> <init-param> <param-name>cors.allowed.origins</param-name> <param-value>*</param-value> </init-param> <init-param> <param-name>cors.allowed.methods</param-name> <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value> </init-param> <init-param> <param-name>cors.allowed.headers</param-name> <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Access-Control-Allow-Origin,Access-Control-Allow-Host</param-value> </init-param> <init-param> <param-name>cors.exposed.headers</param-name> <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials,Access-Control-Allow-Host</param-value> </init-param> <init-param> <param-name>cors.support.credentials</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>cors.preflight.maxage</param-name> <param-value>10</param-value> </init-param> </filter> <filter-mapping> <filter-name>CorsFilter</filter-name> <url-pattern>*</url-pattern> </filter-mapping>
This is my tomcat configuration and now i am able to access Thingworx API using Postman But again i am getting same error in my browser.
Hi @shubhamm.
If one of the previous responses have helped with a solution, please mark the appropriate one as the Accepted Solution for the benefit of others with the same questions.
Regards.
--Sharon
Hi
I try all the solution but still it is not working.
i am getting same error.
Hi @shubhamm.
Just wondering if the article in the previous post helped to resolve your issue. If not, please provide the logs located at \ThingworxStorage\logs. Make sure the logs cover the time period of your testing.
Regards.
--Sharon
hii Sharon,
we have followed https://www.ptc.com/en/support/article/CS229450 article that resolved our issue.
Thanks and Regards,
Shubham