Content Negotiation logic possibly incorrect...? #9452
raphaklaus
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! First of all, thanks for this amazing tool. You guys have been doing an incredible job!
According to this section of the documentation: https://kit.svelte.dev/docs/routing#server-content-negotiation
If the
Acceptheader istext/htmlexecute a browser request, otherwise, the request is going to hit the respective function inside+server.ts.It works perfectly until you have your site requested by a facebookbot/twitterbot/whateverbot that is going to send an arbitrary
Acceptvalue, such as*/*, image/webp. Because it's not atext/htmlit tries to call an HTTP verb-like middleware, but since it doesn't exist a405 Method not allowedis returned. By default this behavior makes websites' SEO capabilities to do not work, requiring some configuring onsrc/hooks.server.ts.To me, it's far-fetched to infer that an arbitrary (or even empty)
Acceptheader should be interpreted as a server call.Beta Was this translation helpful? Give feedback.
All reactions