How do I add text to a response from a remote URL in NGINX?

moyamos nginx-forum at forum.nginx.org
Mon Aug 31 07:49:58 UTC 2020


Hi,

I have the following server in NGINX and it works fine. But, I am wondering
is it possible to add text to a response from a remote URL where hosts my
before_body.txt and after_body.txt? Is there any way to tackle this? Is it
possible at all?

server {
    listen 80;

    root /storage/path;
    index index.html;

    server_name  test.domain.com;

    location / {
       try_files $uri $uri/ =404;
       add_before_body /src/before_body.txt;
       add_after_body /src/after_body.txt;
       autoindex on;
    }

   location /src/ {
       alias /storage/path/content/;
   }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,289227,289227#msg-289227



More information about the nginx mailing list