When using stateless web servlets in #lang webserver with serve/servlet:

Q: Is there a method for identifying the uri-scheme of the inbound request and redirecting HTTP schemed uris to HTTPS scheme for SSL?

Issue 1)

Examining the (url-scheme (request-uri request)) of the request start passed to the servlet's start function returns #f.

Issue 2)

start function is never called if an HTTP-schemed URI reached a servlet configured with:

#:ssl? #t
#:ssl-cert (build-path "my-cert.crt")
#:ssl-key (build-path "myprivatekey.key")

instead, a

Connection error: ssl-accept/enable-break: accept failed (error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request)

is raised on the connection thread.

[note that servlet works as expected with HTTPS-schemed URI. this is absolutely not a PKI, certificate, or OpenSSL problem]

Thanks very much.


Here's an example demonstrating the #f value for url-scheme:



#lang web-server

(provide/contract (start (request? . -> . response?)))

(define (start request)
  (printf "url-scheme is ~A\n" (url-scheme (request-uri request)))
  (response/xexpr
   `(html (head (title "Hello world!"))
          (body (p "Hi Jay")))))


(require web-server/servlet-env)
(serve/servlet start
               #:stateless? #t
               #:launch-browser? #f
               #:connection-close? #t
               #:quit? #f
               #:listen-ip #f
                #:servlet-path "/")


+++++++++++++++++++++++++++++

url-scheme is #f
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to