docma icon indicating copy to clipboard operation
docma copied to clipboard

Getting 404 page when query params are present and routing is set to path on root route

Open JRJurman opened this issue 5 years ago • 5 comments

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.

image

When advertising or posting on sites like Facebook, they can automatically include query params, so being able to ignore these would be super valuable.

JRJurman avatar Oct 30 '19 00:10 JRJurman

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.

JRJurman avatar Oct 30 '19 00:10 JRJurman

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 avatar Oct 30 '19 01:10 JRJurman

@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 avatar Jan 22 '20 05:01 onury

@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.

JRJurman avatar Jan 24 '20 07:01 JRJurman

Ok. Thanks for the info. I'll look into this.

onury avatar Jan 24 '20 22:01 onury