Fork me on GitHub
#babashka
<
2021-06-24
>
bherrmann15:06:10

Is there a reasonably simple (err.. I might mean easy) way to get a babashka webserver going which is https?

Tomas Brejla15:06:20

Good question. Babashka itself includes HttpKit as a server, which itself suggests using reverse proxy such as Nginx to provide HTTPS support. If you wanted to try to spawn https server yourself manually, then I'm affraid you'd need classes in javax.net.ssl package (SSLServerSocket, KeyManager, TrustManager and many other) to be present in babashka . They don't seem to be present in babashka. Btw, what's your use case for having such "inlined", totally-standalone https server?

bherrmann15:06:26

Well, I want to host some html/javascript and I'm lazy. So my first thought was

bb  fileToHost.html
where I can access said file at,
$ open 
I need https because I'm fiddling with CORS and I'm trying to model a problem I'm having at in a larger system.

bherrmann15:06:06

So I want to have https, and I want to be able to manipulate and set response headers (for the CORS stuff.)

lukasz15:06:26

I'd second using a reverse proxy, for your usecase - you can use caddy which can provision a let's encrypt cert for you with one command, no configs needed: https://caddyserver.com/docs/quick-starts/reverse-proxy

borkdude15:06:44

or simply use github pages to upload something?

borkdude15:06:07

oh you need local testing, got it

kokada19:06:04

Can also use something like ngrok if you aren't too paranoic with security (since this is for development, should be fine): https://ngrok.com/docs/2

hairfire21:06:49

Is there a way to generate bindings from a call to "ns-publics" for the options passed to "sci/eval-string"? I tried just passing the result of calling "ns-publics" for the value associated with ":bindings", but it doesn't work. In "sci"'s documentation there's the following example:

(sci/eval-string "(println \"hello\")" {:bindings {'println println}})

borkdude21:06:02

@hairfire let's continue in the #sci channel