简体   繁体   中英

How can I establish a secure connection to a websocket on localhost?

We have an application which we run on a POS terminal, that should receive data from an application running on the same machine, while displaying content from a remote site which is loaded over HTTPS.

To receive the data from the local application, we want to use websockets, which is working fine so far. However, when the site we're displaying is loaded over HTTPS, the websocket connection is required to be encrypted as well.

Because we can't really get a proper certificate for localhost , we're just using a self-signed one. But Chrome won't connect to a websocket that uses a self-signed certificate.

How can we resolve this problem? We can't use an unencrypted websocket, we can't use a self-signed certificate for the encrypted one and we can't get a signed certificate for localhost . What option am I missing?

If you have admin privileges on the POS terminals, how about adding a line to the HOSTS file like:

127.0.0.1 localhost.mycompany.com

Now you can use a real certificate for localhost.mycompany.com in the server application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM