docma
docma copied to clipboard
Getting 404 page when query params are present and routing is set to path on root route
Summary
I've noticed for my site (and the docma site) that query parameters are not ignored if they are included at the end of a path - even though the routing is set to work with the path.
For example, instead of ignoring (or removing) the query param, the page for https://onury.io/docma/?example
shows a 404 page.
When advertising or posting on sites like Facebook, they can automatically include query params, so being able to ignore these would be super valuable.
On some investigation, it looks like it's coming from these lines https://github.com/onury/docma/blob/master/lib/web/DocmaWeb-SPA.js#L96-L102
I'm willing to make a PR for the change, but the way this is written, it appears intentional. Eager to hear feedback if a PR to change this would be accepted.
After doing some more investigation, it appears this issue only occurs on the root route. This can be seen on the docma website as well, if you append a query parameter to the api page https://onury.io/docma/api/?example
@JRJurman sorry for the late reply.
How and what does facebook append as query-string? That's weird.
And yes that's intentional (see this line) because same URL with a query-string actually is a different resource. If not serving it, should render 404, IMO.
@onury when just posting the url for my site in a facebook post, this is the query parameter attached https://tram-one.io/?fbclid=IwAR0FMuUr86D50D15rjYCH8jMm1D8C36BtOE9nszTeZsEFOAmBVgLKUK0lTE
There's also a set of default query params that are attached when creating Facebook ads. Facebook will actually reject the ad because the url resolves as a 404 (with no page content). The query params there are more complicated, but mostly (probably) for tracking. Looking now it appears those can be removed in the ad configuration, but that still doesn't resolve the facebook post issue.
Ok. Thanks for the info. I'll look into this.