4D Blog

Home Product Get ready for the new SameSite and Secure attributes for cookies

Get ready for the new SameSite and Secure attributes for cookies

April 28, 2021

Product

Cookies’ abilities have grown and evolved over the years, but they have left some legacy issues. To handle this, browsers (including Safari, Chrome, Firefox, and Edge) are changing their behavior regarding the SameSite and Secure attributes for a secure-by-default model for cookies.

As a 4D web developer, you may be concerned about the 4D web sessions session cookie if you want to prevent your application from Cross-site request forgery.

To prevent your web session cookie from circulating on the web pointlessly or being misunderstood by browsers because of a default value applied, you should ask if it is:

  • a third-party cookie: associated with a domain name different from that of the page where the cookie is encountered. A third-party cookie is placed by a page object (e.g. an ad) originating from a domain other than the one hosting the page

or

  • a first-party cookie: associated with the domain of the page

 

Depending on your use case, you should choose the appropriate value for the SameSite attribute of your web session cookie.

To reinforce security, the Secure attribute must be set for the web session cookie when the connection is secured (HTTPS) to indicate to the browser that the cookie can be sent safely.

Keep reading to learn how 4D has your back to improve privacy and security across the web.

To enable you to choose how your web server should behave, we have enhanced the web server object by adding a new sessionCookieSameSite property.

Set a Samesite attribute value

By default, the web server will set the SameSite attribute of the session cookie to “Strict“. We’ve chosen this value because it’s the safest.

If you want another value, use the WEB Server command:

var $webServer; $settings : Object

$settings:=New object()
$webServer:=WEB Server
$settings.sessionCookieSameSite:=Web SameSite Lax
$webServer.stop()
$webServer.start($settings)

Each sensitivity value for the SameSite attribute is provided in the 4D language with specific constants:

  • Web SameSite Lax = “Lax”
  • Web SameSite Strict = “Strict”
  • Web SameSite None = “None”

 

Here is an overview of what you’ll see in your browser:

and the secure attribute?

If the SameSite attribute value is “None”, some browsers may require the Secure attribute to be set to another value in order to send it (only if the connection is HTTPS).

The good news is that the 4D web server handles this automatically.

If a connection is HTTPS, the session cookie is automatically set with the Secure attribute, so that browsers will send it.

Here is an overview of what you’ll see in your browser with an HTTPS connection:

 

blank

 

Now let’s work safely with our web applications and discuss this on the forum!

Discuss

Tags Cookie, SameSite, Secure, Session cookie, Web, Web server, Web session

Latest related posts

  • December 3, 2025

    Give AI to a 30 years old 4D application

  • November 28, 2025

    ORDA – Handle an event-driven logic during database operations

  • November 27, 2025

    ORDA – Permissions – Restrict / allow web access to the resources in one click

Avatar
Marie-Sophie Landrieu-Yvert
- Product Owner - Marie-Sophie Landrieu-Yvert joined the 4D Product team as a Product Owner in 2017. In this role, she is responsible for writing user stories and translating them into functional specifications. She also ensures that the delivered feature implementation meets the customer's needs. Marie-Sophie graduated from the engineering school ESIGELEC and began her career as an engineer at IBM in 1995. She took part in various projects (maintenance and development projects) and worked as a COBOL developer. She then moved on to work as a UML designer and Java developer. More recently, her main responsibilities included analyzing and writing functional requirements, and coordinating business and development teams.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy