简体   繁体   中英

Play Framework : How to set cookie with custom path

I am trying to set a cookie on my play application(v1.2.4) and want the path to be "/". But since my application has http.path=/portal, the cookie path is always "/portal". I tried looking for a way to specify defaultCookiePath but could not find anything. It looks like cookie path is always derived from the http.path value.

You can modify the location for the cookie via Play.ctxPath. In bootstrap.java, you can set up the path:

Play.ctxPath="/"; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM