-
-
Notifications
You must be signed in to change notification settings - Fork 674
Strip any number of trailing slashes from realm URLs #3819
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
Conversation
I wonder if importing and using fixRealmUrl for the migration is correct, or if we should instead clone fixRealmUrl and use that, so future changes to it don’t unintentionally change the migration’s behavior. |
I still think it's possible to configure a proxy server in such a way that the extra slash is needed; but if that's explicitly not a case we want to support, I'm okay with that, as long as we make a note of it somewhere. (Possibly this comment.)
Mea culpa. I marked those as
At any rate, I certainly believe the latter two of those things now, and wouldn't be surprised by the first. 🙂
Neither, I think. You're on the right track with the second of those two, but I'm pretty sure we want the migration to just strip slashes, nothing more. |
305fb62
to
3c7548e
Compare
Hmm, I don't have a competent answer to this. @gnprice?
If that's the case, maybe larger changes are needed, and this PR should be closed?
Yes, that makes a lot of sense. I just updated the PR with this (and as always, feedback is welcome). |
Setting aside my other concerns for a moment: I think this is a perfectly fine temporary mitigation – it won't make moving to a URL-object any harder, if and when we do that. |
3c7548e
to
ed04300
Compare
OK, sounds good. I've added that inline comment and made some wording/conventions improvements to the commit messages. And, here, just a gentle bump to @gnprice to take a look at Ray's question about proxy server configuration and the scope of what we'll support, above. |
Marking as priority, following the issue. |
(Bumping this to remind myself to come back to it next week.) |
…ot just one. Requests to /events fail when the realm URL includes trailing slash, e.g., https://example.zulipchat.com//api/v1/events. Current code strips a single trailing slash, but not multiple. Add test for multiple trailing slashes. This bug is a little puzzling because it does not seem to affect other requests, like /register, and no server-side differences among the cases have been identified.
…unts. Fixes: zulip#3567. A trailing slash on a realm URL interferes with /events calls. The parent commit handles multiple trailing slashes only on fresh URL inputs. A migration is needed for users whose cached realm URLs have multiple. Greg points out that we will want to take input from the server on what the canonical realm URL is, and use that.
Thanks @chrisbobbe ! Sorry this has sat for so long. These changes LGTM. About to merge.
Yeah, Zulip in general doesn't support going through a proxy that involves altering the URLs. Like many complex webapps, it has a notion of "what is my base URL", and using that it expects to be able to know exactly what URL from the user perspective corresponds to a given route. I'm not sure we've ever had someone run into trouble from this kind of attempted proxy use case; if that does come up, we'll address it in our production docs. Note we absolutely do support reverse proxies, which are a common tool in deploying webapps. A working reverse proxy has no problem setting up appropriate URLs. |
No problem! 🙂 |
This does the following, to fix #3567:
It also removes some "DEPRECATED" comments that don't seem to apply.