How to redirect a request while adding a cookie
Added by firemanphil over 11 years ago
Hi,
I'm trying to set a cookie in the response of a 302 redirect but it seems that lighttpd is ignoring the set cookie directive. How do I do this? I'm using lighttpd 1.4.32 on Mac OS X. Below is my lighttpd.conf
server.document-root = "${HOME}/pages/" debug.log-request-handling = "enable" server.port = 8000 server.username = "www" server.groupname = "www" ## modules to load # at least mod_access and mod_accesslog should be loaded # all other module should only be loaded if really neccesary # - saves some time # - saves memory server.modules = ( "mod_redirect", "mod_access", "mod_setenv", "mod_accesslog" ) accesslog.filename = "/usr/local/etc/lighttpd/logs/access.log" server.errorlog = "/usr/local/etc/lighttpd/logs/error.log" mimetype.assign = ( ".html" => "text/html", ".txt" => "text/plain", ".jpg" => "image/jpeg", ".png" => "image/png" ) url.redirect-code = 302 static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" ) index-file.names = ( "index.html" ) $HTTP["host"] =~ "^${HOST}:8000$" { setenv.add-response-header += ( "Set-Cookie" => "userID=XXXXXX; expires=Sun, 22-Oct-2023 17:18:37 GMT; path=/" ) url.redirect = ( "^(.*)" => "http://www.google.com" ) }
Thanks,
Phil