Open lleadbet opened 1 year ago
The ordering of plugins is documented here: https://www.apollographql.com/docs/router/customizations/native#request-and-response-lifecycle
It states that Rhai
scripts should execute before any other plugins in any particular stage. If that isn't the case, there may be a bug.
Following up, this was discussed in Slack.
Describe the solution you'd like
The current ordering behavior is not documented, but it appears the JWT plugin happens prior to the
router_service
Rhai stage, which is preventing some use-cases with using that plugin.As an example, should I need to support multiple headers, I would ideally be able to do:
However this isn't respected, as JWT validation comes prior to Rhai. Ideally Rhai should come near the top of the ordering, only behind custom Rust plugins.
Describe alternatives you've considered
A coprocessor, which feels heavy for this type of work that Rhai is well-suited for.
Additional context
Other use-cases:
Authorization
header that supports multiple token formats)