openresty / openresty/headers-more-nginx-module

Can 'sent' HTTP variables work?

Open
#118 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.8k
Forks
236
Avg merge
1h 34m
Merged PRs (30d)
2

Description

I configured:

more_set_headers 'X-Magic: $sent_http_x_slytherin';

Did I understand it correctly that due to module initialisation order, headers-more is executed before the standard headers filter where X-Slytherin is set? Consequently, headers-more will not see X-Slytherin when setting X-Magic.

In other words, the HTTP 'sent' variables as implemented in ngx_http_variable_unknown_header are one of the products of header filters downstream of the headers-more filter that do not yet exist at the time of expanding variables in headers-more.

If I got this right, am I also right that such scenario is an example of undefined behaviour @agentzh referred to in his OpenResty notes when he wrote the below?

Out of sheer curiosity, we shall ask immediately that what would be execution ordering in between more_set_input_headers and rewrite_by_lua, since they both ride on rewrite tail? The answer is : undefined. We must avoid a configuration which relies on their execution orders.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ngx_http_variable_unknown_header entry point and trace the headers-more filter ordering around more_set_input_headers and rewrite_by_lua. The issue is resolved when the availability and ordering of sent variables are established and the supported behavior or limitation is recorded.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.