Skip to content

ngx.var can't set variables prefixed with http_ #439

@adamonduty

Description

@adamonduty

I ran into this issue today:

2014/12/05 21:49:52 [error] 27389#0: *1 lua entry thread aborted: runtime error: access_by_lua:5: variable "http_cache_purge" cannot be assigned a value
stack traceback:
coroutine 0:
        [C]: in function '__newindex'
        access_by_lua:5: in function <access_by_lua:1>, client: 127.0.0.1,

The problem appears to be that the variable was prefixed with http, as changing it to cache_purge fixes the issue. I note the documentation for ngx.var.VARIABLE mentions

Some special nginx variables like $args and $limit_rate can be assigned a value, some are not, like $arg_PARAMETER

but nothing about http_. Are there any other prefixes that will cause the same issue? I can throw together a pull request to fix the docs if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions