I've got two servers, both of which I control. One is a thingworx server that talks to the other, a windchill server, and displays my web page. I've got a thingworx mashup that talks to the windchill server. It pulls images and pdf from the windchill server and allows the operator of the mashup to alter the image or pdf then put it back on the server. I tackled the CORS problem presented when pulling images from the server but now I'm getting CORS errors when POSTing to the server.
I tried putting the CORS filter on the thingworx server but no joy. I had to tell the script to pull the images as crossorigin, so I'm thinking there's some proper way to ask for a crossorigin POST too.
$.ajax({
method: 'POST',
url: urlString,
enctype: 'multipart/form-data',
processData: false,
cache: false,
contentType: false,
processData: false,
type: 'POST',
data: fd
//crossOrigin: true
}).done(function(data) {
console.log('success', data)
});
Works great with CORS checking turned off in chrome.
For current versions of Windchill you can configure CORS as per the following PTC Article: https://support.ptc.com/help/wnc/r12.0.0.0/en/#page/Windchill_Help_Center%2FFileVaultConfigWCforCORS.html%23
This requires CORS filters to be set in the Tomcat config of Windchill.
It seems that you are trying to move content from or to the Windchill server, hence I believe the article above should be applicable in this use case.
Summary of steps:
Configure CORS filters to allow cross-origin http requests using the following procedure. This configuration is applicable to Windchill master and file server sites.
Update the cors.allowed.origin and antiClickJackingUri parameter with the desired web address(es) using comma separated list. Do not use asterisk (*) since cors.support.credentials is required to true.
Please always use the latest PTC Tech Support and Help Articles for most current and up to date information as these steps may change.