Common lisp Hunchentoot启用CORS

Common lisp Hunchentoot启用CORS,common-lisp,hunchentoot,Common Lisp,Hunchentoot,在hunchentoot上启用CORS时,我遇到了一些问题: (hunchentoot:define-easy-handler (one-api :uri *one-endpoint*) () (when (boundp '*acceptor*) (setf (hunchentoot:header-out "Access-Control-Allow-Origin") "*") (setf (hunchentoot:header-out "Accept") "

在hunchentoot上启用CORS时,我遇到了一些问题:

  (hunchentoot:define-easy-handler (one-api :uri *one-endpoint*) () 
    (when (boundp '*acceptor*)
      (setf (hunchentoot:header-out "Access-Control-Allow-Origin") "*")
      (setf (hunchentoot:header-out "Accept") "*/*")
      (setf (hunchentoot:header-out "Access-Control-Allow-Headers") "Content-Type, Accept, Origin") 
      (setf (hunchentoot:header-out "Access-Control-Allow-Methods") "POST, GET, OPTIONS, PUT, DELETE") 
      (setf (hunchentoot:header-out "Access-Control-Allow-Origin") "*") 
      (setf (hunchentoot:content-type*) "text/html"))
    (let* ((raw-data (hunchentoot:raw-post-data :force-text t)))
      (funcall callback raw-data))))

但仍然不起作用,我做错了什么?

以下几点对我起了作用:



在/r/learnlisp上有一个答案:
(setf (header-out "Access-Control-Allow-Origin") "*")
  (setf (header-out "Access-Control-Allow-Methods") "POST,GET,OPTIONS,DELETE,PUT")
  (setf (header-out "Access-Control-Max-Age") 1000)
  (setf (header-out "Access-Control-Allow-Headers") "x-requested-with, Content-Encoding, Content-Type, origin, authorization, accept, client-security-token")
  (setf (header-out "Content-Type") "text/json")