microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.97k stars 1.65k forks source link

Https support on windows #1583

Open Jahrenski opened 3 years ago

Jahrenski commented 3 years ago

Hi, I've setup a basic http server using cpprestsdk on a windows machine and it works. But for the last 2 days, I've attempted to setup the server to respond on https but nothing works.

There isn't anything at all about this use-case that most people need in the documentation. I've tried the google rabbit hole with no success.

My self-signed certificate works on Restbed. Is there a step-by-step tutorial on how to actually make a https cpprestsdk server that works?

adrian-afloarei commented 3 years ago

Hi! I want to try this as well. So far I have found this source https://ib-krajewski.blogspot.com/2015/09/https-support-for-casablanca-server-and.html that I want to try out. Please let me know if this works for you.

kentf commented 3 years ago

The server mode in CPP REST SDK is an "afterthought". It's still in the experimental namespace. As far as I know, the primary use case for the Casablanca project was/is client mode.

That being said, for my use case, CPP REST SDK have the most mature code base.

The default HTTP server for Windows uses http.sys, and it has to be controlled through netsh. And with HTTPS, you must add certificates through that command too, and for good measure can try to run the server as administrator. If it suddenly works as administrator, then there are some permission flags missing for the netsh command.

I didn't bother with that, and I wanted to use openssl and ASIO for both Windows and Linux, so I made the default server implementation to use ASIO in Windows.