How to hide/restrict log/error message in browser from nginx server

A
  • 21 Nov '22
Hi All,

I am new to nginx thing, currently we have primary nginx.conf file under
/etc/nginx/ and serval tenant specific server configuration file present in
/etc/nginx/conf.d/ folder.

So any http request was made it provides verbose nature of error message in
browser , it shows some source code file pat below (currently pasted dummy
browser response): 

at decodeURIComponent (<anonymous>)
    at decode_param (/fdsfsdfdfdsf/layer.js:172:12)
    at Layer.match (/fdsfsdfdfdsf/router/layer.js:123:27)
    at matchLayer (/fdsfsdfdfdsf/index.js:587:18)
    at next (fdsfsdfdfdsf/index.js:226:15)
    at csrf (fdsfsdfdfdsf/index.js:117:5)
    at /fdsfsdfdfdsf/security.js:128:17
    at Layer.handle [as handle_request] (/fdsfsdfdfdsfr/layer.js:95:5)

So my question is is there any way i can hide/restrict this with nginx.conf
file modification or server configuration files modification

Please suggest your thought

Thanks
Ashish

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,295843,295843#msg-295843
S
  • 21 Nov '22
Hi Ashish,

On Mon, Nov 21, 2022 at 06:07:17AM -0500, ashishbijwe wrote:
[...]

> So any http request was made it provides verbose nature of error message in
> browser , it shows some source code file pat below (currently pasted dummy
> browser response): 
> 
> at decodeURIComponent (<anonymous>)
>     at decode_param (/fdsfsdfdfdsf/layer.js:172:12)
>     at Layer.match (/fdsfsdfdfdsf/router/layer.js:123:27)
>     at matchLayer (/fdsfsdfdfdsf/index.js:587:18)
>     at next (fdsfsdfdfdsf/index.js:226:15)
>     at csrf (fdsfsdfdfdsf/index.js:117:5)
>     at /fdsfsdfdfdsf/security.js:128:17
>     at Layer.handle [as handle_request] (/fdsfsdfdfdsfr/layer.js:95:5)
> 
> So my question is is there any way i can hide/restrict this with nginx.conf
> file modification or server configuration files modification

It seems like the issue is related to a backend application behind
nginx, and if that the case it's possible to configure nginx to
intercept a proxy response with the proxy_intercept_errors directive,
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors

Hope that helps.

-- 
Sergey A. Osokin
A
  • 22 Nov '22
Thanks for this !!! It works in my case

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