flagsmith
flagsmith copied to clipboard
API: Treat URLs with and without trailing slash as identical
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, I presume this would be simple change in django configuration which would save time to any developer using the Flagsmith API.
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!
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 /
@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