edicl/hunchentoot

getting scheme/protocol of current request

Closed this issue · 2 comments

is it possible to get the scheme used by the current request? I need to generate an oauth redirect uri. So far I've only been able to get the host: (hunchentoot:host)

It looks like there's a related stackoverflow question:

https://stackoverflow.com/questions/40693291/is-there-a-way-in-hunchentoot-to-get-the-part-of-the-url-before-the-path

I also tried using (hunchentoot:server-protocol*), but it always seems to return HTTP/1.1 even when the request is using https

You can use (acceptor-ssl-p acceptor) in order to know whether the current request is using HTTPS or not.

Once you know this, you should be able to easily generate the complete URL.

Note: (hunchentoot:server-protocol*) will return the version of the HTTP protocol used, this is independent of whether TLS was used or not.