Score:1

nginx mirror directive not working

br flag

I am trying to mirror a request that coming to one of our services, nginx is acting as the web server. I've used the mirror directive to proxy the requests to an AWS ALB, but it seems that nginx is not copying the request to the ALB.

server {
listen       80;
server_name  service-01.example;
root         /srv/www/apps/service-01/public;

location / {
    mirror /mirror;
    try_files $uri @app;
     }
location @app {
    uwsgi_pass unix:/run/uwsgi-apps/service-01.sock;
    uwsgi_read_timeout 300s;

    include uwsgi_params;
    uwsgi_param UWSGI_SCHEME $scheme;
    uwsgi_modifier1 5;}

     location /mirror {
        internal;
        proxy_pass http://aws-alb$request_uri;
}
Score:1
by flag

The proxy_pass directive in the /mirror location block should not include the $request_uri, the mirrored request's URI is preserved by default.

I modified your configuration like that:

server {
    listen       80;
    server_name  service-01.example;
    root         /srv/www/apps/service-01/public;

    location / {
        mirror /mirror;
        try_files $uri @app;
    }

    location @app {
        uwsgi_pass unix:/run/uwsgi-apps/service-01.sock;
        uwsgi_read_timeout 300s;

        include uwsgi_params;
        uwsgi_param UWSGI_SCHEME $scheme;
        uwsgi_modifier1 5;
    }

    location /mirror {
        internal;
        proxy_pass http://aws-alb; # Remove the $request_uri variable
    }
}
I sit in a Tesla and translated this thread with Ai:

mangohost

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.