serving files from /proc

Jérôme Loyet ml at fatbsd.com
Tue Dec 12 15:17:11 UTC 2023


Hello,

I'm trying to serve some files from /proc but nginx return a 0 bytes
content because the file size of many files in /proc/ tree is simply 0 by
design.

here is my sample conf file:
...
location = /route {
  root /proc/net;
}

and the result of the corresponding curl:
> GET /route HTTP/1.1
> Host: 172.16.0.3:1513
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.23.1
< Date: Tue, 12 Dec 2023 15:08:00 GMT
< Content-Type: text/plain
< Content-Length: 0
< Last-Modified: Tue, 12 Dec 2023 15:08:00 GMT
< Connection: keep-alive
< ETag: "65787750-0"
< Accept-Ranges: bytes

is there a simple way to configure nginx to return the cotent of
/proc/net/route or any other file in /proc ?

thanks
regards
++ Jerome
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20231212/405fa9e1/attachment.htm>


More information about the nginx mailing list