How can I achive this behavor in nginx

fi flag

What is the configuration needed in Nginx to achieve the following behavior:

Whenever a request is received, it should be forwarded to application A; if application A returns { "allowed" :true} in response, the same request should be forwarded to application B and the response from application B should be returned to the client. However, if application A returns a { "allowed" : false} in response, the server should return a response with a status code of 401.

Something like this:

server {
   listen  80;

location / {
    # forword request to App-A;
    # Read the response
    if response['allowed'] == true;
        # forword it to application B
        return '401';
gr flag


You can have a look at Authelia or Authentik for the authentication application.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.