Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DEBUG=1 notice to server #1288

Merged
merged 1 commit into from
Jul 28, 2020
Merged

Add DEBUG=1 notice to server #1288

merged 1 commit into from
Jul 28, 2020

Conversation

mariusandra
Copy link
Collaborator

Changes

Running PostHog with DEBUG=1 in production and behind a HTTPS proxy (e.g. nginx) causes issues with the toolbar. Under these conditions the Secure flag will be removed from the session cookie, causing browsers to either display a warning like so:

image

... or (soon?) to not acknowledge to cookie at all. This is especially the case with SameSite=None cookies that we use to get the session ID when running the toolbar on someone's site.

When DEBUG=1 is set, then settings.SESSION_COOKIE_SECURE is not set as we are assumed to run on HTTP. That is correct behavior, as turning on Secure when over HTTP would cause the session cookie to be ignored.

This PR adds a warning message that shows when PostHog is running with DEBUG=1. We should dissuade users from doing this in production. Hopefully those affected will act accordingly.

image

I'll make a separate PR for "running development over https" (probably via ngrok) later.

Checklist

  • All querysets/queries filter by Team (if applicable)
  • Backend tests (if applicable)
  • Cypress E2E tests (if applicable)

@mariusandra mariusandra requested a review from timgl July 28, 2020 14:01
@timgl timgl temporarily deployed to posthog-dev-mode-warnin-a2rhq8 July 28, 2020 14:01 Inactive
@timgl timgl merged commit efcfad4 into master Jul 28, 2020
@timgl timgl deleted the dev-mode-warning branch July 28, 2020 20:20
@timgl
Copy link
Collaborator

timgl commented Jul 28, 2020

I like this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants