No exemplo do nginx tem o location, segue:
json
server {
#
# ...
#
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate server_ssl.crt.pem;
ssl_certificate_key server_ssl.key.pem;
ssl_client_certificate /root/chain-pix-webhooks-prod.crt;
ssl_verify_client optional;
ssl_verify_depth 3;
#
# ...
#
location /webhook {
if ($ssl_client_verify != SUCCESS) {
return 403;
}
rewrite ^(.)$ /webhook;
}
}
Já no exemplo de Flasky, é so inserir no @app.route o caminho de onde o certificado seria exigido, exemplo:
py
@app.route("/webhook", methods=["POST"])
def imprimir():
imprime = print(request.json)
data = request.json
with open('data.txt', 'a') as outfile:
outfile.write("\n")
json.dump(data, outfile)
return jsonify(imprime)