使用 Github Webhooks 和 secret 配置 Nginx

问题描述

我一直在寻找一种方法来配置我的 Nginx 以侦听来自 Github 的 webhooks 的 POST 请求。

我在 Github 中配置了一个新的 Webhook,如下所示:

有效载荷 URL: https://myUrl/payload 秘密:这就是秘密

我的目标是告诉 Nginx:一旦你收到 POST 请求(在我的例子中是 Github webhook),如果你得到的标头与“thisisthesecret”匹配,则返回“OK”并将有效负载放在 https://myUrl/payload

除了 this 示例外,我在网上找不到它的任何实现,因此我正在寻求您的帮助。

这是我当前的 nginx.config 文件:

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;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...