Drone generates broken Webhooks in Gitea

I searched both the issue tracker and the forum but did not find anything that resembles my issue.

I have a server where both my Gitea and my Drone server are behind Nginx as a reverse proxy. When I add a repo to Drone, it creates a Webhook for the repository. However, when I try to test the webhook, Gitea just fails, telling me that both the request and the response are “N/A”. If I, however, create the exact same webhook by hand, Gitea is able to fire the webhook with success.

I am able to re-create the issue without the reverse proxy which tells me that it is not the culprit.
To reproduce the issue the following compose file was used:

version: "2.0"

services:
  gitea:
    image: "gitea/gitea:latest"
    volumes:
      - gitea_data:/data
    environment:
      - USER_UID=9002
      - USER_GID=9002
      - APP_NAME=Gitea
      - RUN_MODE=prod
    ports:
      - "3000:3000"
    networks:
      internal:
        ipv4_address: "240.1.0.3"
  drone:
    image: "drone/drone:latest"
    volumes:
      - ./drone:/data
      - /var/run/docker.sock
    environment:
      - DRONE_GITEA_SERVER=http://240.1.0.3:3000
      - DRONE_HOST=240.1.0.4
      - DRONE_PROTO=http
    networks:
      internal:
        ipv4_address: "240.1.0.4"

volumes:
  gitea_data:
    driver: local

networks:
  internal:
    external: false
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 240.1.0.0/8 

Steps to recreate:

  1. Create an account on the Gitea instance (240.1.0.3)
  2. Create a repository with a .drone.yml file. I used
    kind: pipeline
    name: default
    steps:
    - name: test
      image: alpine:3.9
      - sh test.sh

The test.sh file just contains echo "Hello World"
3. Log in to Drone, activate the repository
4. In Gitea, go to the repository’s webhook settings. If the URL for the webhook is http://localhost[...], change it to http://240.1.0.4[...]. Try to “test deliver” the webhook.

The result should be a failed delivery with “N/A” as both request and response data.
5. Copy the URL of the webhook, create a new webhook, paste the url there and type something for the secret. “Test deliver” the webhook and it should work.

The root cause is incorrect configuration parameters. You need the following adjustments:

    environment:
      - DRONE_GITEA_SERVER=http://240.1.0.3:3000
-     - DRONE_HOST=240.1.0.4
-     - DRONE_PROTO=http
+     - DRONE_SERVER_HOST=240.1.0.4
+     - DRONE_SERVER_PROTO=http

[1] https://docs.drone.io/installation/gitea/single-machine/

I changed the values you pointed out and am still able to reproduce my issue.

Just to be sure:

  1. I downed the whole compose file with docker-compose -f <my file> down
  2. Changed the values
  3. docker-compose -f <my file> up

Sorry, I am unable to reproduce. The webhook is definitely created from DRONE_SERVER_HOST and DRONE_SERVER_PROTO and the only possible root cause for the problem you described is when these values are not properly set. Perhaps the change was not picked up by Docker compose? Either way I can confirm there are no issues with webhooks in master.

This is quite the weird issue. Even after pulling the image again and manually starting the container by copy-pasting the instructions from the documentation I still cannot use the webhook that Drone creates for my repository.