G
G
grabbee2017-02-16 13:37:19
Nginx
grabbee, 2017-02-16 13:37:19

Is it possible to cache nginx pages with authorization by headers?

Is it possible to cache a page where access is restricted by the Authorization Bearer header ? There are no passwords or cookies, stateless requests. JWT header only. How to properly configure the cache, if possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry MiksIr, 2017-02-16
@grabbee

All headers are translated into $http_...

$http_name is
an arbitrary request header field; the last part of the variable name matches the field name converted to lowercase, with dashes replaced with underscores

Those. just mix proxy_cache_key with $http_authorization variable
For example:
proxy_cache_key $scheme$proxy_host$request_uri$http_authorization;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question