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

API: Treat URLs with and without trailing slash as identical #491

Open
luk355 opened this issue Nov 15, 2021 · 4 comments
Open

API: Treat URLs with and without trailing slash as identical #491

luk355 opened this issue Nov 15, 2021 · 4 comments
Assignees
Labels
api Issue related to the REST API improvement Improvement to the existing platform

Comments

@luk355
Copy link
Contributor

luk355 commented Nov 15, 2021

Currently, any API calls without trailing / character returns default "Flagsmith API" response. This behavior is quite unusual in API world as its recommended to primarily accept API requests without trailing slash.

To quote a few articles:

A trailing forward slash (/) should not be included in URIs. This is one the most important rules to follow as the last character within a URI’s path, a forward slash (/) adds no semantic value and may cause confusion. REST API’s should not expect a trailing slash and should not include them in the links that they provide to clients.

As the last character within a URI’s path, a forward slash (/) adds no semantic value and may confuse. It’s better to drop it from the URI.

It would be great to treat requests with and without trailing slash as identical.

@dabeeeenster dabeeeenster added api Issue related to the REST API improvement Improvement to the existing platform labels Nov 15, 2021
@dabeeeenster dabeeeenster changed the title API: Threat URLs with and without trailing slash as identical API: Treat URLs with and without trailing slash as identical Nov 15, 2021
@luk355
Copy link
Contributor Author

luk355 commented Jun 29, 2023

@dabeeeenster, I presume this would be simple change in django configuration which would save time to any developer using the Flagsmith API.

@matthewelwell
Copy link
Contributor

Hi @luk355 , I'd love it to be that simple but django's management of this has always been a little bit confusing, particularly its interaction with django rest framework's routers and viewsets. I'll take a look at it to see what we can do, but it's not as trivial as it sounds!

@jobstoit
Copy link

Any updates on this? Currently trying to use a self managed flagsmith with apps within Kubernetes and in Kubernetes it's not working (possibly because the CNI is trying to sanitise the requests and thereby removing the trailing /). Since it's managed Kubernetes I'm unable to change CNI settings so we'd love the possibility of flagsmith working without a required trailing /

@matthewelwell
Copy link
Contributor

@jobstoit we have a lot of installations running on k8s in a variety of different platforms so I'm surprised that this is causing an issue. Do you have more information about the issues you're facing? Perhaps you can raise them in our discord channel? Here's an invite: https://discord.gg/QydC8y8U

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API improvement Improvement to the existing platform
Projects
None yet
Development

No branches or pull requests

5 participants