企业管理 > 文件存储和复制 > 文件存储 > 使用外部文件电子仓库 > 将 Windchill 配置为允许跨源资源共享 (CORS) 请求
  
将 Windchill 配置为允许跨源资源共享 (CORS) 请求
出于安全考虑,浏览器将限制从第三方网站启动的跨源 http 请求。PTC 建议您在 Windchill 服务器中启用跨源请求,以便可从第三方网站下载请求。使用 Tomcat CORS 筛选器可在 Windchill 中启用上载和下载请求。
如果已为 Windchill 服务器配置 CORS 筛选器,则需要将现有配置与下述配置合并。完成 Windchill 更新和升级后应重新配置 CORS 筛选器。
站点管理员应通过以下步骤将 CORS 筛选器配置为允许跨源 http 请求。此配置适用于 Windchill 主站点和文件服务器站点。
1. 导航到 <Windchill_Home>\codebase\WEB-INF\web.xml
2. 更新 web.xml 文件中的下列 ContentCorsFilterContentHttpHeaderSecurityFilter 以及 Mapping 配置:
<filter>
<filter-name>ContentCorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>[ALLOWED_ORIGINS]</param-value>
</init-param>
<init-param>
<param-name>cors.support.credentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,OPTIONS</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With</param-value>
</init-param>
</filter>
<filter>
<filter-name>ContentHttpHeaderSecurityFilter</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>ALLOW-FROM</param-value>
</init-param>
<init-param>
<param-name>antiClickJackingUri</param-name>
<param-value>[ALLOWED_ORIGINS]</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ContentCorsFilter</filter-name>
<url-pattern>/servlet/WindchillAuthGW/wt.content.ContentHttp/viewContent/*</url-pattern>
<url-pattern>/servlet/WindchillAuthGW/wt.fv.master.StandardMasterService/doDirectDownload/*</url-pattern>
<url-pattern>/servlet/WindchillAuthGW/wt.fv.replica.StandardReplicaService/doDownload/*</url-pattern>
<url-pattern>/servlet/WindchillAuthGW/wt.fv.replica.StandardReplicaService/doIndirectDownload/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ContentHttpHeaderSecurityFilter</filter-name>
<url-pattern>/servlet/WindchillAuthGW/wt.content.ContentHttp/viewContent/*</url-pattern>
<url-pattern>/servlet/WindchillAuthGW/wt.fv.master.StandardMasterService/doDirectDownload/*</url-pattern>
<url-pattern>/servlet/WindchillAuthGW/wt.fv.replica.StandardReplicaService/doDownload/*</url-pattern>
<url-pattern>/servlet/WindchillAuthGW/wt.fv.replica.StandardReplicaService/doIndirectDownload/*</url-pattern>
</filter-mapping>
* 
cors.allowed.originantiClickJackingUri 参数更新为所需的网址 (采用逗号分隔列表)。请勿使用星号 (*),因为 cors.support.credentials 必须为 true。
3. 保存 web.xml 文件。
4. 重新启动 Windchill 服务器。