Which method is best for CSP nonce?

hi
I’ve written two methods for CSP nonce

method one:
in my phoenix code with plug

method two:
with Nginx web server

I have two questions:

  1. do I need setup CSP nonce in a web server and Phoenix ? or one of them enough

  2. my priority is security and performance, which method is better?

anybody can help me?