rexyai / RestRserve

R web API framework for building high-performance microservices and app backends
https://restrserve.org
275 stars 32 forks source link

HTTPS support/documentation #143

Open hongooi73 opened 4 years ago

hongooi73 commented 4 years ago

Hello,

Apologies if this is a noobish question. I notice that the readme states RestRserve supports HTTPS; however is there anywhere that the process of adding this is documented?

dselivanov commented 4 years ago

We have an example here - https://github.com/rexyai/RestRserve/blob/master/inst/examples/ssl/app.R.

Contribution in a form of article would be appreciated!

blosloos commented 3 years ago

Yes, a more detailed documentation to use TLS over https with RestRserve would be wonderful; plain http may not be preferred by everyone nowadays. I absolutely appreciate your package, and have been using it to set up a http POST - it works great, and is well documented!

Have been trying to make sense of examples/ssl for a while until I got https working with a slightly different setup than outlined there. Especially by struggling with (a) the underlying Rserve configs (e.g., what's a QAP server, set by another port 6313?) and (b) CA certification via, e.g., certbot and Let's encrypt (which in itself works well, too, on CentOS).

dselivanov commented 3 years ago

Yeah, encryption is a bit complicated topic. I tend to use load balancers (HAproxy or nginx) in front of RestRserve which do SSL termination. Or in practice I much more frequently use AWS ELB which does SSL termination and then routes traffic within private network to right services.

So Rserve and RestRserve do support SSL/TLS, but in practice I never used this feature.

@blosloos if you want to add an article I can help to review. But I don't see myself adding comprehensive docs about https any time soon.

blosloos commented 3 years ago

Thanks for your reply and details! Yes, a short article would be great, and I would add one (i.e., how to set up TLS with RestRserve on a UNIX server on some port, using certbot and let's encrypt, maybe with some hints/links on how certificates and the private/public key concept works for signatures and encryption, lots of fragmented information otherwise) - similarly, if I had the time ...

pkinif commented 2 years ago

Hi @blosloos, @dselivanov,

I am trying to deploy my RestRserve API using HTTPS/docker-compose/nginx/certbot. Deploying on port 8080 is not a problem for me, but it gets stuck as soon as I want to integrate HTTPS. If I understand correctly, RestRserve does not work with port 453 but port 8483? Do you know if, since your previous exchange, new documentation has been published somewhere?

dselivanov commented 2 years ago

Could you please describe your architecture in more details? Which service is responsible for ssl offloading? Nginx? Typically I recommend delegate SSL offloading to loadbalancer such as nginx or haproxy and make restrserve work in plain http mode.