Set-Cookie on Nginx Location
location /cookie/ {
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires 1h;
log_not_found off;
add_header custom_header "1234";
add_header Set-Cookie "myCookie=1234; max-age=300; HttpOnly; Secure";
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi.conf;
fastcgi_cache zone_simple.geekyflare.com;
fastcgi_cache_valid 200 2m;
fastcgi_cache_valid 404 1m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
add_header cookie-controled-cache-2m $upstream_cache_status;
add_header custom_header "1234";
add_header Set-Cookie "myCookie=1234; max-age=300; HttpOnly; Secure";
}
location ~* /cookieabcd\.(html)$ {
add_header custom_header "abcd";
add_header Set-Cookie "myCookie=abcd; max-age=300; HttpOnly; Secure";
}