Cookies are pieces of information that are stored in the browser of a website visitor. Cookies are used to store user-specific information, such as login data or shopping baskets.

A website's cookies should be secured at all times so that they cannot be read or manipulated by third parties. This article gives you an introduction to the topic.

Notes

Deny access

Set-Cookie response header

The HTTP Set-Cookie response header is generated by the server and used to transfer cookies to the client. You can use the HttpOnly attribute of the header to control the access of JavaScript applications to the cookie content: Set-Cookie: MyCookie=MyValue; Path=/; HttpOnly

PHP

If you use PHP, you can simply set the flag using the setcookie() function. PHP itself already sets a session cookie, which you can influence using the session_set_cookie_params() function.