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

Toggle DEBUG_TB_INTERCEPT_REDIRECTS from the toolbar #267

Open
samuelhwilliams opened this issue Jun 8, 2024 · 3 comments
Open

Toggle DEBUG_TB_INTERCEPT_REDIRECTS from the toolbar #267

samuelhwilliams opened this issue Jun 8, 2024 · 3 comments

Comments

@samuelhwilliams
Copy link
Contributor

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. :)

@davidism
Copy link
Member

davidism commented Jun 8, 2024

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.

@samuelhwilliams
Copy link
Contributor Author

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 :)

@samuelhwilliams
Copy link
Contributor Author

samuelhwilliams commented Jun 9, 2024

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
Labels
None yet
Development

No branches or pull requests

2 participants