K
K
kahi42015-03-16 21:22:01
Nginx
kahi4, 2015-03-16 21:22:01

Nginx conditions when serving content, how to execute a bash script and give a page depending on the result of execution?

There are a large number of internal use services designed as web applications. All have a single authorization system. However, they are written in different programming languages ​​(there is such a legacy :( ), due to which even small changes in the authorization system turn into pain.
There was an idea to generalize this at the nginx level. authorization.Nginx is expected to poll this program in the presence of a cookie token in order to check the validity of the token.If successful, return the content.If unsuccessful, redirect (ideally just give the application response) to the login page.Thus
, authorization will be a generalized module.
Actually the question is: how to organize it with the help of nginx? (heard about the possibility of writing scripts in lua, how suitable is this?)
Well, in pursuit - is there a more convenient way to organize such functionality?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2015-03-16
@kahi4

You have described the process in a difficult way.
Look at this module:
nginx.org/ru/docs/http/ngx_http_auth_request_modul...
The bottom line is that you can make a backend (script) that will validate the user and return some response code, based on which this module will already or let or not let.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question