CodePen public Pen versus Pro Private Pen for sensitive code
0 reputation · 16 Aug 2021, 21:01 UTC
0 reputation · 16 Aug 2021, 21:01 UTC
I want to keep HTML, CSS, and JavaScript in a CodePen Pen from being opened by anyone who has the Pen URL. The code contains no server secrets, but it should not appear in public browsing or search results.
CodePen free accounts create Pens as public by default, and there is no free option to make an existing Pen private without changing account type. CodePen Pro offers Private Pens, but current plan terms and enforcement behavior should be confirmed before relying on them. It is unclear whether a Private Pen URL requires authentication on every request or depends on link obscurity alone. Cached copies or search-engine indexes may also remain accessible after visibility changes.
Does a CodePen Pro Private Pen enforce authentication on every request to its URL, or is access controlled by URL obscurity alone? Can a free account change an existing public Pen to private without upgrading? Are cached copies or search-engine indexes removed immediately after switching a Pen from public to private, or is there a documented delay?
34775 reputation · 17 Aug 2021, 05:12 UTC
1. Authentication on Private Pen URLs
Private Pens in a CodePen Pro account are protected by HTTP authentication. Every request to the Pen’s URL is checked against the logged‑in user’s session; unauthenticated visitors are redirected to the CodePen login page and never receive the raw HTML/CSS/JS.
2. Free Accounts Cannot Make a Pen Private
Free accounts can only create public Pens. Changing an existing Pen’s visibility from public to private requires upgrading to a Pro plan; there is no free‑tier option to alter visibility.
3. Cache and Search‑Engine Visibility After Visibility Change
When a Pen is switched to private, the CodePen servers stop serving it to unauthenticated users immediately. However, cached copies in browsers, CDNs, or search‑engine snapshots may persist for a short period (typically the cache TTL or until the next crawl). Search engines will eventually drop the page from their index after the next crawl cycle, but removal is not instant and some cached snippets may remain visible for days.
<meta name="robots" content="noindex, nofollow"> tag to the <head> of your Pen. This instructs crawlers not to index the page. Note that this does not remove already‑cached copies.Do you need to enforce that the Pen is excluded from search engine indexes immediately after you change its visibility, or is a short delay acceptable for your use case?
Use comments to ask for clarification. Post a solution as an answer.
5,930 reputation · 16 Aug 2021, 21:31 UTC
It is important to distinguish between discovery privacy (hiding a Pen from profiles and search engines) and access control (preventing unauthorized viewing via a direct link). For those evaluating CodePen Pro for sensitive code, consider these technical distinctions: