1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 09:48:14 +00:00

295 Commits

Author SHA1 Message Date
Niek
d4438b5a09
prevent double slash 2024-02-19 12:23:19 +01:00
Nicolas Duchon
76778cebb1
refactor: parse LOG_JSON as boolean + avoid unnecessary backticks 2024-02-10 18:40:18 +01:00
Denis Arh
de9809a9e5 Add more control over log_format config directive
Introduces 3 new environmental variables:
 - `LOG_FORMAT`
 - `LOG_FORMAT_ESCAPE`
 - `LOG_JSON`

`LOG_FORMAT` and `LOG_FORMAT_ESCAPE` default to standard values.
When `LOG_JSON` is set, defaults are changed to: `{"time_local":"$time_iso8601","client_ip":"$http_x_forwarded_for","remote_addr":"$remote_addr","request":"$request","status":"$status","body_bytes_sent":"$body_bytes_sent","request_time":"$request_time","upstream_response_time":"$upstream_response_time","upstream_addr":"$upstream_addr","http_referrer":"$http_referer","http_user_agent":"$http_user_agent","request_id":"$request_id"}`and `json`.

See `nginx.tmpl` and https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format for details
2024-02-10 17:39:16 +01:00
jmformenti
fa23c11edb
feat: define basic auth for virtual path 2024-02-10 16:24:00 +01:00
Nicolas Duchon
40a347bfae
fix: add non standard port to Host header 2024-02-10 15:23:35 +01:00
Nicolas Duchon
d46881fb58
Merge pull request #2321 from theFra985/patch-1
Add support for grpcs protocol
2024-01-16 18:59:45 +01:00
Nicolas Duchon
d56e8f1d8a refactor: $server_found and $servers aren't both needed 2023-12-26 18:43:05 +01:00
Nicolas Duchon
7ce72d59a9 feat: add auto keepalive setting 2023-12-26 18:33:28 +01:00
Nicolas Duchon
26db13387e refactor: explicitely default keepalive to disabled 2023-12-26 17:58:24 +01:00
Nicolas Duchon
5c1db95551 feat: enable proxy_buffering 2023-12-25 17:27:34 +01:00
Gilles Filippini
a2ade38abb fix #2310
Check the '.Internal' network property, because the .Gateway property is
defined for internal networks as well.
2023-12-19 19:21:00 +01:00
Nicolas Duchon
4c556290f9
fix: enforce TLSv1.3 on Mozilla-Modern SSL policy 2023-12-08 22:41:29 +01:00
Nicolas Duchon
c6868ed6be
fix: SSL cipher suites / TLSv1.3 2023-12-08 22:06:07 +01:00
Nicolas Duchon
ec0d908a44
feat: add AWS TLS 1.3 security policies 2023-12-08 17:59:26 +01:00
Nicolas Duchon
664ba246fd
fix: remove unsupported TLSv1.3 from new AWS SSL policies 2023-12-08 16:44:48 +01:00
patrickdk
099ac04576
feat: add new SSL policies 2023-12-08 16:44:47 +01:00
Nicolas Duchon
018db70367
refactor: re-organise template for HTTP/3 feature
Co-authored-by: Nicolas Duchon <nicolas.duchon@gmail.com>
Co-authored-by: Niek <100143256+SchoNie@users.noreply.github.com>
2023-12-08 00:48:08 +01:00
Nicolas Duchon
b5cc9b1aa2
feat: experimental http3 support
Co-authored-by: Nicolas Duchon <nicolas.duchon@gmail.com>
Co-authored-by: Knapoc <Knapoc@users.noreply.github.com>
2023-12-08 00:48:08 +01:00
Nicolas Duchon
5af973b193
feat: optionally disable HTTP/2 2023-12-08 00:48:08 +01:00
Francesco Cattoni
a5566f5e8f
Added support for grpcs protocol 2023-10-22 00:34:32 +02:00
Nicolas Duchon
45c181b972 build: update template for nginx 1.25.1
http2 on the listen directive have been deprecated and replaced by the server level http2 directive.
2023-07-04 07:54:38 +02:00
Nicolas Duchon
c1a2b31f35
Merge pull request #2222 from rot169/support-hostnet-containers
Support containers running --net=host (#1537)
2023-06-07 07:55:28 +02:00
azlux
a06bb9e68b
fix: add missing cipher suite to Mozilla-Intermediate (#2247) 2023-05-22 12:21:35 +02:00
Nicolas Duchon
35b1493e16
feat: support proxy + container in host network mode 2023-05-09 19:31:42 +02:00
Nicolas Duchon
b88d33d2f3
feat: handle multiple proxy networks 2023-05-09 00:58:05 +02:00
Nicolas Duchon
e2539b04f5
fix: always on session cache on HTTPS fallback listener 2023-05-08 23:14:09 +02:00
Andy
325fd01ebb Support containers running --net=host (#1537)
Detect if a target container is running host networking, and if so, use the IP address of the first bridge net gateway.
2023-04-23 14:09:33 +01:00
Richard Hansen
035bd2b5ac fix: Remove default_server listen option from fallback server
This fixes a bug introduced in commit
9b4bb07b348dc5a428b94416517291adb30794c3.
2023-04-13 01:16:54 -04:00
Richard Hansen
9b4bb07b34
fix: Don't create fallback http(s) server when http(s) disabled
Before, a fallback http server was created to handle requests for
unknown virtual hosts even when `HTTPS_METHOD=nohttp`.  (In this case,
all http vhosts would be unknown.)  Likewise, a catch-all fallback
https server was still created even if `HTTPS_METHOD=nohttps`.

Now the fallback servers are created only if needed.  This brings the
behavior in line with the documentation and user expectation.  It will
also make it easier to implement a planned feature: different servers
on different ports.
2023-02-04 18:59:38 -05:00
Richard Hansen
9297e94389
fix: Emit TLS error if there are no certs available
Before, if neither the vhost-specific cert nor `default.crt` existed,
nginx-proxy would not create the https vhost.  This resulted in nginx
either refusing the connection or serving the wrong vhost depending on
whether there was another https vhost with a certificate.

Now nginx-proxy always creates an https server for a vhost, even if
the vhost-specific certificate and the default certificate are both
missing.  When both certs are missing, nginx is given empty
certificate data to make it possible for it to start up without an
error.  The empty certificate data causes the user to see a TLS error,
which is much easier to troubleshoot than a connection refused error
or serving the wrong vhost.
2023-02-02 22:02:06 -05:00
Richard Hansen
16066cab61
fix: Don't create cert error https server if https is not enabled 2023-02-02 17:17:00 -05:00
Richard Hansen
18d0671312
chore: Factor out duplicate checks for default.crt
for improved readability.
2023-02-01 18:56:16 -05:00
Richard Hansen
7a2b1f8833
chore: Split $is_https variable into two separate checks
for improved readability.
2023-02-01 18:17:43 -05:00
Niek
7ca1da8358
feat: Add support for HTTP load balancing between the proxy and upstream server groups (#2173)
Add initial tests

Newlines

Remove unused variable

Co-authored-by: Richard Hansen <rhansen@rhansen.org>

Change comment value

Co-authored-by: Richard Hansen <rhansen@rhansen.org>

add missing services line

Co-authored-by: Richard Hansen <rhansen@rhansen.org>

Use deploy.replicas

Remove details about choosing a load balancing method

Feedback note

Co-authored-by: Nicolas Duchon <nicolas.duchon@gmail.com>
2023-03-21 07:49:27 +01:00
Richard Hansen
49bb37dfdb feat: Add support for HTTP keep-alive between the proxy and upstream 2023-03-14 04:20:17 -04:00
Richard Hansen
364beed773 fix: Don't error if $globals.CurrentContainer is nil
Also:
  * Note when there are no networks.
  * Fix "networks available" comment.
2023-03-10 15:23:44 -05:00
Nicolas Duchon
afd6544702
Merge pull request #2179 from rhansen/swarm
fix: Partially revert "chore: Remove support for legacy swarm"
2023-02-28 07:40:16 +01:00
Jan Malte Gerth
37134c44d7 fix: Sort networks and ports before iterating
This avoids unnecessary nginx restarts caused by config file churn.
2023-02-21 00:22:47 -05:00
Richard Hansen
6207be5f8f fix: Partially revert "chore: Remove support for legacy swarm"
This partially reverts commit 2494e207843c92a715da3e8e65ed763fd0d2d624
by ignoring any network named "ingress" when searching for a
container's IP address.

That commit was technically a backwards-incompatible change: Some
users use nginx-proxy with Swarm mode even though it is not fully
supported.  In such cases nginx-proxy should ignore the `ingress`
network, otherwise nginx will not be able to reach the
server (container-to-container traffic apparently doesn't work over
the Swarm `ingress` network).

The parts of that commit that examine the `SwarmNode` structure are
not reverted here because docker-gen does not currently populate that
structure -- not even when both docker-gen and the service task
container are running on the same manager node.
2023-02-17 01:52:05 -05:00
Richard Hansen
11a46f728c chore: Factor out container IP:port lookup
This will make planned future changes easier.
2023-02-01 03:06:39 -05:00
Richard Hansen
2494e20784 chore: Remove support for legacy swarm
It doesn't work with the newer Docker Swarm mode so it doesn't have
much value anymore.
2023-02-01 03:04:37 -05:00
Richard Hansen
2115974e93 feat: Add ability to completely override location blocks
Co-authored-by: Trent Harvey <trent@harvdog.net>
2023-01-31 04:53:12 -05:00
Richard Hansen
6162427c45 fix: Generate at most one server directive per container 2023-01-28 18:01:19 -05:00
Richard Hansen
bcec2d9075 chore: Refactor upstream template for readability
In particular, reduce the nesting depth to make it easier to
understand what the code is doing by:

  * converting an $O(nm)$ nested loop into two serial $O(n)+O(m)$
    loops, and
  * consolidating similar nested `if` cases.
2023-01-28 18:01:19 -05:00
Richard Hansen
daeed502cb feat: Add a warning comment if the container port is published 2023-01-28 18:01:19 -05:00
Richard Hansen
5a8a6ceae2 chore: Improve debug comments in upstream template 2023-01-28 18:01:19 -05:00
Richard Hansen
2760ead490 chore: Remove warning comment when port is not exposed
Exposing ports is largely deprecated because it doesn't actually do
anything in Docker.
2023-01-28 18:01:19 -05:00
Richard Hansen
e97bf606c8 chore: Move version comment to the top of the template
to ensure that the version is always the first output line.

Also, always output `# nginx-proxy`, even if the version isn't known.
This makes it easier to find the start of the generated config in the
output of `nginx -T`.
2023-01-28 18:01:19 -05:00
Vincent Herlemont
07cc80ac6b
feat: Support LOG_FORMAT env variable (#2151) 2023-01-27 12:28:40 -05:00
Richard Hansen
8346b68a28 fix: Ignore VIRTUAL_HOST set to the empty string
Fixes #2144
2023-01-23 20:48:16 -05:00