Skip to content

Work with Nginx

Joel Chu edited this page Apr 14, 2018 · 2 revisions

You might not want to expose the http://yourdomain.com:8081/webhook like this so you could set this up with nginx easily

server {

  server_name yourdomain.com;

  # This part will point to your git-webhook-ci server
  location /webhook {
    proxy_pass http://localhost:8081;
    proxy_set_header Host $host;
    # getting the visitor info
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    # for socket connection
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
  }
  # This is your regular host setup
  location / {
    proxy_pass http://localhost:8080;
    proxy_set_header Host $host;
    # getting the visitor info
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    # for socket connection
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
  }
}

Then just change your callback url to http://yourdomain.com/webhook