woodpecker/docs/docs/30-administration/70-proxy.md
Anbraten 9267a46d5c
[Docs] Migrate docs framework to Docusaurus (#282)
- Replace mkdocs with docosaurus (improved menu structure, ...)
- Structure docs into `Usage` and `Server Setup / Administration`
- Update favicon
- Create new pipeline-syntax page with all options and links to more detailed docs if available
- Add ci to publish to `woodpecker-ci.github.io`
- Deploy docs preview to surge for review
- Update start-page

Co-authored-by: 6543 <6543@obermui.de>
2021-09-11 17:10:32 +02:00

3 KiB

Proxy

Apache

This guide provides a brief overview for installing Woodpecker server behind the Apache2 webserver. This is an example configuration:

ProxyPreserveHost On

RequestHeader set X-Forwarded-Proto "https"

ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/

You must have the below Apache modules installed.

a2enmod proxy
a2enmod proxy_http

You must configure Apache to set X-Forwarded-Proto when using https.

ProxyPreserveHost On

+RequestHeader set X-Forwarded-Proto "https"

ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/

Nginx

This guide provides a basic overview for installing Woodpecker server behind the nginx webserver. For more advanced configuration options please consult the official nginx documentation.

Example configuration:

server {
    listen 80;
    server_name woodpecker.example.com;

    location / {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;

        proxy_pass http://127.0.0.1:8000;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_buffering off;

        chunked_transfer_encoding off;
    }
}

You must configure the proxy to set X-Forwarded proxy headers:

server {
    listen 80;
    server_name woodpecker.example.com;

    location / {
+       proxy_set_header X-Forwarded-For $remote_addr;
+       proxy_set_header X-Forwarded-Proto $scheme;

        proxy_pass http://127.0.0.1:8000;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_buffering off;

        chunked_transfer_encoding off;
    }
}

Caddy

This guide provides a brief overview for installing Woodpecker server behind the Caddy webserver. This is an example caddyfile proxy configuration:

woodpecker.mycompany.com {
    gzip {
        not /stream/
    }
    proxy / localhost:8000 {
        websocket
        transparent
    }
}

You must disable gzip compression for streamed data otherwise the live updates won't be instant:

woodpecker.mycompany.com {
+   gzip {
+       not /stream/
+   }
    proxy / localhost:8000 {
        websocket
        transparent
    }
}

You must configure the proxy to enable websocket upgrades:

woodpecker.mycompany.com {
    gzip {
        not /stream/
    }
    proxy / localhost:8000 {
+       websocket
        transparent
    }
}

You must configure the proxy to include X-Forwarded headers using the transparent directive:

woodpecker.mycompany.com {
    gzip {
        not /stream/
    }
    proxy / localhost:8000 {
        websocket
+       transparent
    }
}

Ngrok

After installing ngrok, open a new console and run:

ngrok http 80

Set WOODPECKER_HOST (for example in docker-compose.yml) to the ngrok url (usually xxx.ngrok.io) and start the server.