Transport options | laravel-webhook-server-go | Spatie       

 SPATIE  

laravel-webhook-server-go
=========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-webhook-server-go](https://spatie.be/docs/laravel-webhook-server-go/v1)  Transport options

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-webhook-server-go/v1) 

  Transport options    
- [ Introduction ](https://spatie.be/docs/laravel-webhook-server-go/v1/introduction)
- [ Installation and setup ](https://spatie.be/docs/laravel-webhook-server-go/v1/installation-and-setup)
- [ Sending webhooks ](https://spatie.be/docs/laravel-webhook-server-go/v1/sending-webhooks)
- [ Signing requests ](https://spatie.be/docs/laravel-webhook-server-go/v1/signing-requests)
- [ Retrying failed webhooks ](https://spatie.be/docs/laravel-webhook-server-go/v1/retrying-failed-webhooks)
- [ Transport options ](https://spatie.be/docs/laravel-webhook-server-go/v1/transport-options)
- [ Events ](https://spatie.be/docs/laravel-webhook-server-go/v1/events)
- [ Testing webhooks ](https://spatie.be/docs/laravel-webhook-server-go/v1/testing-webhooks)
- [ Differences from PHP ](https://spatie.be/docs/laravel-webhook-server-go/v1/upgrading)
- [ Testing ](https://spatie.be/docs/laravel-webhook-server-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-webhook-server-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/laravel-webhook-server-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-webhook-server-go/v1/support-us)

 Transport options
=================

###  On this page 

1. [ Proxies ](#content-proxies)
2. [ Mutual TLS ](#content-mutual-tls)
3. [ TLS verification ](#content-tls-verification)
4. [ Laravel HTTP configuration ](#content-laravel-http-configuration)

Proxies
-----------------------------------------------------------------------------

Configure `cfg.Transport.Proxy` globally or set `o.Transport.Proxy` for a call. `Transport.Proxies` maps URL schemes to proxy URLs and `NoProxy` lists exact hostnames or dot-prefixed domain suffixes to bypass. Go's environment proxy defaults apply when no explicit proxy is selected.

```
call.Configure(func(o *webhookserver.Options) {
    o.Transport.Proxy = "http://proxy.server:3128"
    o.Transport.NoProxy = []string{"internal.example.com", ".example.net"}
})
```

Mutual TLS
--------------------------------------------------------------------------------------

Mutual TLS authenticates both parties. Your application verifies the endpoint's server certificate, and the endpoint verifies your application's client certificate.

```
err := webhookserver.From(ctx).Call("https://other-app.com/webhooks").
    Payload(map[string]string{"event": "order.created"}).Secret("your-shared-secret").
    Configure(func(o *webhookserver.Options) {
        o.Transport.Certificate = "certificates/client.pem"
        o.Transport.PrivateKey = "certificates/client-key.pem"
        o.Transport.CAFile = "certificates/ca.pem"
    }).DispatchSync(ctx)
```

Files must be readable by the worker. Certificate and key files use Go's `tls.LoadX509KeyPair` PEM format. Encrypted key passphrases are not queued. Decrypt keys in application code and inject an in-memory `tls.Certificate` through `Config.Client` when needed. Never put private key bytes or passphrases in queue data.

TLS verification
--------------------------------------------------------------------------------------------------------

HTTPS certificates are verified by default. A verification failure fails the attempt. `Transport.CAFile` selects a custom PEM trust bundle. Avoid disabling verification. If necessary, explicitly set `Transport.InsecureSkipVerify = true` for that destination.

Laravel HTTP configuration
--------------------------------------------------------------------------------------------------------------------------------------

Laravel HTTP fakes, hooks and global headers apply to webhook requests. The package sets the request timeout, disables inner HTTP retries and applies explicit transport options. Do not add retries through hooks if you expect one HTTP request per queue attempt.

Go's default redirects, TLS and proxy behavior replace Guzzle-specific options. There is no cookie jar. The package disables the framework's implicit connection-only timeout in favor of the configured total timeout. Explicit per-call transports close connections rather than retaining a new pool for every delivery.

Use `Config.Client` to replace the PHP job's `createRequest` and `requestOptions` extension points:

```
webhookserver.New(func(cfg *webhookserver.Config) {
    cfg.Client = func(ctx context.Context, d webhookserver.Delivery, client *httpclient.Client) (*httpclient.Client, error) {
        return client.CheckRedirect(func(*http.Request, []*http.Request) error {
            return http.ErrUseLastResponse
        }), nil
    }
})
```

Build from the supplied client to preserve the application's HTTP fakes and hooks. For shared connection pools or custom certificate loading, construct a transport once in application configuration and return `client.Transport(transport)`.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
