-
Notifications
You must be signed in to change notification settings - Fork 152
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
Preserve query string on redirect #609
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
Given that |
My use-case is that I'd like to have links to pages like |
So if I understand correctly, in this scenario you (or some proxy) are creating/embedding tracking IDs into static files for tracking/metrics purposes? |
Yes, essentially that's right. The example I used is for tracking conversion rates from Facebook ads. But the use case is actually still broader. Concretely, I'm using whitenoise to serve a NextJS statically generated app. This means that I have several Technically I can do what I need by including a trailing slash in all URLs (thus bypassing the redirect), but that's ugly and more importantly error prone as it's easy to forget. |
Okay I understand the benefit. Would you be interested in duplicating this PR into ServeStatic? For the last 5 years, things have been moving fairly slowly in |
@Archmonger Done, see Archmonger/ServeStatic#48 |
Hi there 👋
On one of my Django projects, I got tripped up by whitenoise stripping query strings on redirect, so for example
/foo?bar=baz
redirects to/foo/
when I was expecting it to instead redirect to/foo/?bar=baz
. Would you be open to merging a patch that preserves the query string on redirect?I'm opening a pull request to show what an implementation could look like and to start the discussion. If you're happy with the proposal, I can work on putting the functionality behind a setting (to not break backwards compatibility), unit tests, and what-ever else is needed.
Thanks for your time!