Skip to content
Personal hosting. A great start.What our customers say Read our Google reviews
Client portal ↗Log in ↗

Knowledge & practice

Securing cookies for login sessions

Cookies can remember preferences and sessions. For a login session, security, validity and the right settings belong together.

Personal support · Clear pricing

Published 25 December 2024 · Updated 11 October 2026

Use HTTPS and appropriate attributes

The Secure attribute restricts shipping to HTTPS. HttpOnly prevents ordinary client-side JavaScript from reading the cookie. SameSite affects shipping when requests are made from other sites.

Limit the scope and duration

Choose an appropriate path, domain scope and expiration time. Do not store passwords or unnecessary personal data in a cookie. For authentication, the server must reliably validate the session.

Cookies are not the whole security

Safe cookies do not replace control over permissions or protection against unwanted requests. Keep track of your application and dependencies and check your session management.

Test the actual user stream

Check login, log out and run out of a session. External payment or login flows may request a different SameSite choice than a regular website.

Share this article

Copy the link to save this article or share it with someone else.

Did you find this article helpful?

Let us know whether this explanation helped you.

0 people found this article helpful.

Tips and news

More to discover.

Also read our other tips about hosting and your website.

1 / 2

Put your plans into action

Reliable hosting for your website.

Whether you have your own business website or build websites for clients, choose reliable hosting with free SSL and personal support. Explore our plans and choose what suits your website.

WhatsAppCookie settings

You can always change your preferences later via the footer.

Privacy policy

Personal help with your plans

How can we help you?

Choose a topic. We'll help you find the right solution.
Please don't include passwords, payment details or other login credentials.