ring

2020-06-30T06:13:05.097700Z

I can't set the name and can't set the cookie secure don't understand what i am doing wrong ... I did the same as examples found on the web

2020-06-30T06:13:15.098Z

I fanybody has some tips ?

2020-06-30T06:13:16.098200Z

thanks

2020-06-30T08:42:20.098400Z

Hi, I have some troubles to have a secure session cookie with ring I tried all the solutions i could find on the web, but it does not work and i still have a cookie named "ring-session" once i set a value in the session. The cookie name is not reflected and the cookie not secure Here is my code

(defroutes app-routes
           (GET "/" req  {:body  (str req)
                          :session {:test 1}}))

(def my-api-defaults
  (-> secure-api-defaults
      (assoc-in [:session :store] (cookie-store))
      (assoc-in [:session :cookie-name] "JSESSIONID")))

(def app
  (-> (handler/site app-routes)
      (wrap-defaults my-api-defaults)))

(defn start-server
  []
  (run-jetty app {:port 9291
                  :ssl? true}))

(defn -main [& args]
  (start-server))
Does someone have any ideay on what i am doing wrong ? (i use tomcat to deploy the war )

jumar 2020-06-30T10:02:50.098500Z

Is the "tomcat deployment" part of the problem? Does it work when running from the REPL?

jumar 2020-06-30T10:05:43.098700Z

@ouvasam I haven't used this with apis only UI. Looking at the api-defaults and site-defaults I'd say that the problem is there's no top-level :session config in api-defaults.

2020-06-30T10:09:19.098900Z

Many thanks but if i set as secure-site-defaults, it stay the same. It create cookie for the session, but also create a ring-session once i want to set a value in the session 😞

jumar 2020-06-30T10:11:50.099100Z

I don't use special :cookie-name It might be a stupid question but why do you need that?

2020-06-30T10:14:17.099300Z

Cookie name is not really the problem, but it show that these params are not taken in account. Secure cookie is the main problem. With secure-site-defaults, it create a correct cookie with the correct name and the coorect secure flag. But once i set avalue, it create a ring-session cookienon secure I think the problem should come from tomcat (servlet) but i can't find how to set and use the sesssion there

jumar 2020-06-30T10:15:46.099600Z

Does it work in the REPL?

2020-06-30T10:17:51.099800Z

i can't test a secure connection wihtout tomcat

2020-06-30T10:18:31.100Z

The code is from all the place that use seomthing similar so i think it should work, but they don't use tomcat

2020-06-30T10:28:18.100200Z

many thanks to had a look @jumar! 🙏