I have been looking for a way to configure my Nginx to listen to POST requests of webhooks from Github.
I configured a new Webhook in Github as follows:
Payload URL: https://myUrl/payload Secret: thisisthesecret
My goal is to tell Nginx: once you receive POST request (Github webhook in my case), if the header you got matches "thisisthesecret" then return "OK" and put the payload under https://myUrl/payload
Except for this example I couldn't find any implementation of it online so I am reaching out to your assistance.
This is my current nginx.config file:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}