[英]Accessing Expressjs resources from a different port (CORS)
I've got one development environment on localhost:3050 and another running on localhost:3000. 我在localhost上有一个开发环境:3050,另一个在localhost:3000上运行。
I've got various static files being served as mounted directories from :3050, eg: 我有各种静态文件作为安装目录从:3050,例如:
app.use('/app',express.static(__dirname + '/app'));
I've configured Access-Control-Allow-Origin so that CORS requests from :3000 to :3050 are permitted. 我已配置Access-Control-Allow-Origin,以便允许从3000到3050的CORS请求。 Indeed the request goes through, but the application which is expecting to find files on http://localhost:3000 , can't.
确实请求通过,但是期望在http:// localhost:3000上找到文件的应用程序不能。
I'm aware of options of proxies or setting up an SSH - would these be a good idea for this use case? 我知道代理选项或设置SSH - 这对于这个用例是个好主意吗?
I would have thought express should have some kind of way to adjust the domain:port location for the hosting of files - hoping I might just be missing something. 我本以为express应该有某种方式来调整域:托管文件的端口位置 - 希望我可能只是遗漏了一些东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.