Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Model Context Protocol
    • Vector Database
    • Heroku Inference
      • Inference Essentials
      • AI Models
      • Inference API
      • Quick Start Guides
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Security
  • App Security
  • Cookies and the Public Suffix List

Cookies and the Public Suffix List

English — 日本語に切り替える

Last updated April 30, 2024

Table of Contents

  • Historical context
  • Cedar and herokuapp.com
  • For more information

herokuapp.com is included in the Mozilla Foundation’s Public Suffix List. This list is used in recent versions of several browsers, such as Firefox, Chrome and Opera, to limit how broadly a cookie may be scoped. In other words, in browsers that support the functionality, applications in the herokuapp.com domain are prevented from setting cookies for *.herokuapp.com. Note that *.herokuapp.com cookies can currently be set in Internet Explorer, but this behavior should not be relied upon and may change in the future.

This has no effect on applications using custom domains.

Historical context

Scoping cookies

Normally, a website may set browser cookies scoped either to its own domain, or any higher level DNS domain it belongs to. This is controlled by the “domain” attribute in the server’s Set-Cookie HTTP response header. For example, https://www.cs.berkeley.edu/ can set a cookie in the user’s browser that might be retransmitted to only itself, to all hosts ending in cs.berkeley.edu (e.g., radlab.cs.berkeley.edu), or even all hosts ending in berkeley.edu (e.g., english.berkeley.edu). It can NOT set cookies scoped to all hosts ending in edu (e.g., www.stanford.edu). This is not unique to .edu, but applies to all Top-Level Domains (TLDs), including .com, .org, and .net. The server is, of course, perfectly capable of passing a Set-Cookie header with domain=.edu, but it is not honored by any well-secured browser.

This restriction on cookie setting at the TLD level has been around since the early days of the web. It exists because of security reasons, both to prevent accidentally retransmitting cookies to 3rd parties, and to help provide some partial protection against cookie stuffing and more general types of session fixation attacks. The general reasoning is that web servers within the same DNS subdomain are usually considered to be operated by the same organization (In our earlier example, the University of California, Berkeley), and are thus less likely to attack each other. This is not true at the TLD level, as most TLDs allow any member of the general public to register a subdomain.

Not just a TLD problem

This becomes more complicated when we consider many countries use second-level domains (e.g., .co.uk and .ne.jp) as pseudo TLDs, and have few or no restrictions on who may register subdomains (e.g., amazon.co.uk).

To address that issue, for many years, browser vendors used internally-maintained lists of public domains, regardless of what level those domains fell in the DNS hierarchy. Inevitably, this led to inconsistent behavior across browsers at a very fundamental level.

The Public Suffix List

The Mozilla Foundation eventually began a project known as the Public Suffix List, to record all of these public domains and share them across browser vendors. Not all browsers use the Public Suffix List.

Cedar and herokuapp.com

Because Heroku applications on the Cedar stack are all hosted by default in the herokuapp.com domain, we also deal with the public suffix issue.

We believe the benefit of registering ourselves with the Public Suffix List outweighed the loss of what is a dangerous and minimally useful bit of functionality—being able to share cookies across multiple apps.

While there are many legitimate use cases for sharing cookies across multiple applications in a common domain, this is done better and more safely by using a custom domain for your applications.

For more information

  • The Public Suffix List project also has a partial list of other areas where the list is used. This is available at https://publicsuffix.org/learn/.
  • The session fixation and cookie hijacking problem, including a good description of how it applies to Heroku specifically, is outlined in the paper Origin Cookies: Session Integrity for Web Applications.
  • To learn more about the general browser security model, both for cookies and general, we recommend Michal Zalewski’s excellent book, The Tangled Web.

Keep reading

  • App Security

Feedback

Log in to submit feedback.

WebSocket Security Creating a Self-Signed SSL Certificate

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices