Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 92f46e8

Browse files
committed
Add IPs to certificate
1 parent c76242b commit 92f46e8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ this order:
6666
1. the output of `hostname -f` in the container (which can be set with
6767
the `hostname` and `domainname` options).
6868

69+
Mkcert will always add the IPs of the container to the certificate, so
70+
`curl`'ing HTTPS on the IP should always work.
71+
6972
```yaml
7073
volumes:
7174
- '${HOME}/.local/share/mkcert:/mkcert:ro'

files/etc/my_init.d/mkcert.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ VIRTUAL_HOST="${VIRTUAL_HOST/#./*.}"
2424
# If on MKCERT_DOMAINS is set use VIRTUAL_HOST as fallback.
2525
MKCERT_DOMAINS="${MKCERT_DOMAINS:-${VIRTUAL_HOST}}"
2626

27-
# If we couldn't find any domain names just exit now without
28-
# generating any certificates.
29-
if [[ -z "${MKCERT_DOMAINS}" ]]; then
30-
exit 0;
31-
fi
27+
# Always add the container IP(s) so HTTPS will work on the bare IP
28+
# too.
29+
MKCERT_DOMAINS="${MKCERT_DOMAINS} $(hostname -I)"
3230

3331
# Split a space separated string into a bash array.
3432
IFS=' ' read -r -a MKCERT_DOMAINS <<< "${MKCERT_DOMAINS}"

0 commit comments

Comments
 (0)