Override which query parameter determines "amp mode" #23929
dan-weaver
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Feature request
Currently, for hybrid pages, I think
?amp=1
is the only way to tell next to do all the amp goodness. Wondering if it's a good idea to be able to override this behavior. If there is another way please let me know! Is there somewhere we can rewrite query params more generally?Is your feature request related to a problem? Please describe.
We have various apps that are all behind the same CDN / Origin that use a different URL parameter to know whether to render amp or non amp. Not all of these applications use next and in general we'd like to be able to customize the behavior of next to continue using our internal conventions that differ from
?amp=1
without handling nextjs traffic too differently.Describe the solution you'd like
New to looking at this code in too much depth, but it looks like this bit here would have to change. I'm not sure whether this is best to be configured in the userConfig (
next.config.js
) or on the pageConfig.https://github.com/zeit/next.js/blob/canary/packages/next/next-server/server/render.tsx#L458
Describe alternatives you've considered
I think we could probably solve this problem by doing url rewrites etc. at our cdn / nginx or whatever to hide this bit of nextjs behavior from the rest of our stack but I'd like to be able to use the same url scheme's in development that we do in production without jumping through hoops.
Willing to try PR'ing this if it sounds like a good idea.
Beta Was this translation helpful? Give feedback.
All reactions