Skip to content

Toggle DEBUG_TB_INTERCEPT_REDIRECTS from the toolbar #267

Open

Description

@samuelhwilliams

At the moment, the debug toolbar provides an interstitial page upon redirects by default. This can be configured on/off explicitly with the DEBUG_TB_INTERCEPT_REDIRECTS setting.

I'd find it really useful if this could be toggled directly from the toolbar on the page. :)

Activity

  1. davidism commented on Jun 8, 2024

    @davidism
    Member

    In general this isn't possible. Config cannot be changed after the application starts, because there's no way to ensure that change is propagated to other workers, depending on how the server is being used. The built-in Flask dev server uses threads, so it would work there, but it can also be configured for processes, and most other servers use processes.

  2. samuelhwilliams commented on Jun 9, 2024

    @samuelhwilliams
    ContributorAuthor

    Ah, interesting technical constraint, that's fair. I was definitely only thinking of the basic local dev case. It's obviously not the end of the world using the config option :)

  3. samuelhwilliams commented on Jun 9, 2024

    @samuelhwilliams
    ContributorAuthor

    I was just poking around the debug toolbar - could it not be achieved using the fldt_active cookie?

    See example I've thrown together here: main...samuelhwilliams:flask-debugtoolbar:toggle-redirect-intercept-from-panel

    Some questions around how it would interact (or whether it would replace) the DEBUG_TB_INTERCEPT_REDIRECTS env var, and I've hardcoded some things that should probably be referenced more cleanly (eg cookie name and value), but functionally that works as I'd like for this feature.

    I'd be open to cleaning it up, adding tests and raising a PR if it's something you're open to (provided you can share some thoughts on what to do with the env var).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions