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

Reinis Rozitis r at
Tue Sep 1 13:54:06 UTC 2020

> > Now instead you want the content of the url
> >
> Yes, that's right.

Can you actually open the file on the external server - and does it have the content you expect (without redirects)?

Note that since you have proxy_pass without the trailing slash nginx will send the request as  '/src/before_body.txt'. 

If there is no such /src/ directory on the remote server but only /before_body.txt then you have to add the slash at the end:

location /src/ {


More information about the nginx mailing list