kevinkreiser/prime_server

trailing slashes

nilsnolde opened this issue · 3 comments

We had an issue where trailing slashes cause Valhalla to not recognize the action, e.g. https://valhalla1.openstreetmap.de/status/ 404s.

Generally, trailing slashes seem to be a PITA since it's really a different URL and I'm not sure who's to blame or where to fix it 😅 it was a react native lib which is doing some bs by just altering a URL for no reason (i.e. adding a trailing slash where there was none). Still, people could do it accidentally or even out of habit. Who should strip it the trailing slash or should we even deal with it?

-prime_server maybe shouldn't since it'd be hard-coded and that'd be quite a enforcement?

  • Should Valhalla be robust to that?
  • Otherwise it'd need another web server (which it almost always needs anyways) and simple docker setups (localhost etc) would be out of luck?
  • just not care at all and point out it's simply the wrong URL? (which it really is)

Or optionally redirect to non-trailing slash URL in prime_httpd via an argument?

i would argue that 404 is the correct interpretation. just like a filesystem uri, /status is an object where as /status/ is a directory.

i assume you saw this as well: facebook/react-native#24428

Yeah I was maybe overthinking this. I’m actually surprised this is the first time popping up.

Others around the internetz are here and there arguing one defines a resource, the other doesn’t (though sometimes one way, sometimes the other way around😄).

I’ll add a redirect on apache, even it’s kinda wrong URL, but not the first time we patch other people’s/lib’s wrong-ish behavior ;)