总而言之,我正在使用像dicom文件的api这样的观众,称为基石,为此,我连接到dc4chee的WADO服务以获取dicom,dcm4chee运行端口8080,我的节点上的应用程序使用端口3000,所以我试图显示浏览器的dicom.
https://www.npmjs.com/package/cornerstone-wado-image-loader
这是浏览器显示的错误
XMLHttpRequest can not load http: // localhost: 8080 / wado? RequestType = WADO & studyUID = 1.2.840.113704.1.111.5 ... 26513.429 & contentType = application% 2Fdicom & transferSyntax = 1.2.840.10008.1.2. In 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http: // localhost: 3000' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
在指定的文档中
请注意,Web服务器必须支持跨源资源共享,否则图像将无法加载.如果您无法在Web服务器上启用CORS,而您正在加载DICOM P10实例,则可以使用反向代理.这是一个基于http-proxy的简单Node.js,它添加了你可能觉得有用的CORS头文件.
并显示此示例代码,但我使用快递,此代码不起作用
Var http = require ('http'),
HttpProxy = require ('http-proxy');
Var proxy = httpProxy.createProxyServer ({target: 'http: // localhost: 8042'}) .listen (8000);
Proxy.on ('proxyRes', function (proxyReq, req, res, …Run Code Online (Sandbox Code Playgroud)