caddy/caddytest/integration
Emily ddb1d2c2b1
caddyhttp: add http.request.local{,.host,.port} placeholder (#6182)
* caddyhttp: add `http.request.local{,.host,.port}` placeholder

This is the counterpart of `http.request.remote{,.host,.port}`.

`http.request.remote` operates on the remote client's address, while
`http.request.local` operates on the address the connection arrived on.

Take the following example:

- Caddy serving on `203.0.113.1:80`
- Client on `203.0.113.2`

`http.request.remote.host` would return `203.0.113.2` (client IP)

`http.request.local.host` would return `203.0.113.1` (server IP)
`http.request.local.port` would return `80` (server port)

I find this helpful for debugging setups with multiple servers and/or
multiple network paths (multiple IPs, AnyIP, Anycast).

Co-authored-by: networkException <git@nwex.de>

* caddyhttp: add unit test for `http.request.local{,.host,.port}`

* caddyhttp: add integration test for `http.request.local.port`

* caddyhttp: fix `http.request.local.host` placeholder handling with unix sockets

The implementation matches the one of `http.request.remote.host` now and
returns the unix socket path (just like `http.request.local` already did)
instead of an empty string.

---------

Co-authored-by: networkException <git@nwex.de>
2024-03-27 21:36:53 +00:00
..
caddyfile_adapt rewrite: uri query replace operation (#6165) 2024-03-22 02:23:42 +00:00
testdata caddyfile: Implement heredoc support (#5385) 2023-02-26 00:34:27 +00:00
acme_test.go acmeserver: add policy field to define allow/deny rules (#5796) 2024-02-24 02:26:00 +03:00
acmeserver_test.go acmeserver: add policy field to define allow/deny rules (#5796) 2024-02-24 02:26:00 +03:00
autohttps_test.go ci: fix integration tests (#5079) 2022-09-24 19:00:55 +00:00
caddyfile_adapt_test.go caddytls: verifier: caddyfile: re-add Caddyfile support (#6127) 2024-02-26 00:13:48 +03:00
caddyfile_test.go caddyhttp: add http.request.local{,.host,.port} placeholder (#6182) 2024-03-27 21:36:53 +00:00
handler_test.go ci: fix integration tests (#5079) 2022-09-24 19:00:55 +00:00
leafcertloaders_test.go ci: fix the integration test TestLeafCertLoaders (#6149) 2024-03-06 02:09:13 +03:00
listener_test.go httpredirectlistener: Only set read limit for when request is HTTP (#5917) 2023-11-20 12:31:36 +00:00
map_test.go ci: fix integration tests (#5079) 2022-09-24 19:00:55 +00:00
pki_test.go caddyfile: Reject directives in the place of site addresses (#6104) 2024-02-19 00:22:48 +00:00
reverseproxy_test.go reverseproxy: configurable active health_passes and health_fails (#6154) 2024-03-20 11:13:35 -06:00
sni_test.go filesystem: Globally declared filesystems, fs directive (#5833) 2024-01-13 20:12:43 +00:00
stream_test.go filesystem: Globally declared filesystems, fs directive (#5833) 2024-01-13 20:12:43 +00:00