gpt4 book ai didi

ssl - meteor / Apollo : SSL Access for HTTPS and WS?

转载 作者:太空宇宙 更新时间:2023-11-03 14:37:39 24 4
gpt4 key购买 nike

我正在尝试让 SSL 在 Meteor 中为 https 和 websockets 工作。我收到此错误:

(STDERR) Error: listen EACCES 0.0.0.0:443

这是我的设置。

为了 SSL 访问,我安装了 nourharidy/meteor-ssl。我可以使用人们发现有用的任何类似的包或方法!

根据 nourharidy/meteor-ssl 的要求,在 server/main.js 我有:

SSL('/path/to/private/server.key','/path/to/private/server.crt', 443);

这是我的其余设置:

我的 ROOT_URL 环境变量是:

https://10.0.1.10:443 //I’m using my Mac’s ip address so that another Mac can access it

imports/startup/server/index.js 我有:

//SET UP APOLLO QUERY / MUTATIONS / PUBSUB
const USING_HTTPS = true;
const httpProtocol =  USING_HTTPS ? "https" : "http";
const localHostString = '10.0.1.10' //I’m using my Mac’s ip address so that another Mac can access it

const METEOR_PORT = 443;
const GRAPHQL_SUBSCRIPTION_PORT = 4000;
const subscriptionsEndpoint = `wss://${localHostString}:${GRAPHQL_SUBSCRIPTION_PORT}/subscriptions`;

const server = express();
server.use('*', cors({ origin: `${httpProtocol}://${localHostString}:${GRAPHQL_SUBSCRIPTION_PORT}` }));
server.use('/graphql', bodyParser.json(), graphqlExpress({
    schema
}));
server.use('/graphiql', graphiqlExpress({
    endpointURL: '/graphql',
    subscriptionsEndpoint: subscriptionsEndpoint
}));
// We wrap the express server so that we can attach the WebSocket for subscriptions
const ws = createServer(server);
ws.listen(GRAPHQL_SUBSCRIPTION_PORT, () => {
    console.log(`GraphQL Server is now running on ${httpProtocol}://${localHostString}:${GRAPHQL_SUBSCRIPTION_PORT}`);

    // Set up the WebSocket for handling GraphQL subscriptions
    new SubscriptionServer({
        execute,
        subscribe,
        schema
    }, {
        server: ws,
        path: '/subscriptions',
    });
});

我错过了什么?

非常感谢大家提供的任何信息!

最佳答案

Stack Overflow 的工作方式是您付出一些努力并接近问题,我们将帮助您解决最后一点问题。就如何使用 Google 寻求帮助就是我们所说的离题。

如果您在 Google 上搜索 Error: listen EACCES 0.0.0.0:443 会得到一堆结果,第一个是这样的:

Node.js EACCES error when listening on most ports

所以我愿意提供帮助,但你也需要帮助自己

关于ssl - meteor / Apollo : SSL Access for HTTPS and WS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46249101/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com