[GH-ISSUE #383] Is it pssible to create ONE certificate to be used by all of my local development? #253

Open
opened 2026-02-25 22:32:58 +03:00 by kerem · 9 comments
Owner

Originally created by @Nefcanto on GitHub (Jul 16, 2021).
Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/383

I have a lot of websites and web apps. I'm using .local as my development TLD. For example:

  • shop.local
  • user.game.local
  • api.geo.local
  • admin.cars.local
  • investor.brokerage.local
  • ...

This list is not known beforehand, thus I can't use SAN.

But is there possible to create ONE and ONLY ONE general *.* certificate that can be used by all of these local domains?

Originally created by @Nefcanto on GitHub (Jul 16, 2021). Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/383 I have a lot of websites and web apps. I'm using `.local` as my development TLD. For example: - shop.local - user.game.local - api.geo.local - admin.cars.local - investor.brokerage.local - ... This list is not known beforehand, thus I can't use SAN. But is there possible to create ONE and ONLY ONE general `*.*` certificate that can be used by all of these local domains?
Author
Owner

@rfay commented on GitHub (Jul 16, 2021):

mkcert -h shows you how to create a cert with many domain names, including wildcards.

$ mkcert example.com myapp.dev localhost 127.0.0.1 ::1
Generate "example.com+4.pem" and "example.com+4-key.pem".

Just list all of your domains there.

<!-- gh-comment-id:881437574 --> @rfay commented on GitHub (Jul 16, 2021): `mkcert -h` shows you how to create a cert with many domain names, including wildcards. > $ mkcert example.com myapp.dev localhost 127.0.0.1 ::1 Generate "example.com+4.pem" and "example.com+4-key.pem". Just list all of your domains there.
Author
Owner

@Nefcanto commented on GitHub (Jul 16, 2021):

Thank you @rfay for answering.

The point is, I don't know the name of the domains. Thus I can't list them there. Does this command work?

mkcert *.*

<!-- gh-comment-id:881454820 --> @Nefcanto commented on GitHub (Jul 16, 2021): Thank you @rfay for answering. The point is, I don't know the name of the domains. Thus I can't list them there. Does this command work? `mkcert *.*`
Author
Owner

@rfay commented on GitHub (Jul 16, 2021):

No, you can't create certs without knowing the names of the domains you're creating the certs for.

I maintain ddev though, that does all this for you on the fly (using mkcert). Maybe that would be an option for you.

But no, you cannot use any tool to create an "Accept-anything" cert. This is about certs and how they work, it's not about mkcert. You'd have to write your own browser and neuter its capabilities to do that. It's called "http" instead of "https".

<!-- gh-comment-id:881456775 --> @rfay commented on GitHub (Jul 16, 2021): No, you can't create certs without knowing the names of the domains you're creating the certs for. I maintain [ddev](https://github.com/drud/ddev) though, that does all this for you on the fly (using mkcert). Maybe that would be an option for you. But no, you cannot use any tool to create an "Accept-anything" cert. This is about certs and how they work, it's not about mkcert. You'd have to write your own browser and neuter its capabilities to do that. It's called "http" instead of "https".
Author
Owner

@Nefcanto commented on GitHub (Jul 16, 2021):

OK, thank you. I understood. There is no possibility for a universal wildcard certificate to be used for development.

This means that I have to automate the certificate creation process somehow so that for each project I won't be required to create a certificate, update the Nginx config file, and create an entry in local DNS.

<!-- gh-comment-id:881574168 --> @Nefcanto commented on GitHub (Jul 16, 2021): OK, thank you. I understood. There is no possibility for a universal wildcard certificate to be used for development. This means that I have to automate the certificate creation process somehow so that for each project I won't be required to create a certificate, update the Nginx config file, and create an entry in local DNS.
Author
Owner

@minecraftchest1 commented on GitHub (Aug 24, 2021):

You could try mkcert *.local. That should do a catch-all for everything under .local tld.

<!-- gh-comment-id:904966999 --> @minecraftchest1 commented on GitHub (Aug 24, 2021): You could try `mkcert *.local`. That should do a catch-all for everything under .local tld.
Author
Owner

@Nefcanto commented on GitHub (Aug 25, 2021):

@minecraftchest1 this is what I got:

Created a new certificate valid for the following names 📜

  • ".local"
    Warning: many browsers don't support second-level wildcards like "
    .local" ⚠️

Reminder: X.509 wildcards only go one level deep, so this won't match a.b.local ℹ️

The certificate is at "/Temp/Local/Certificate.pem" and the key at "/Temp/Local/Key.pem"

It will expire on 25 November 2023 🗓

So, this is not practical.

<!-- gh-comment-id:905197011 --> @Nefcanto commented on GitHub (Aug 25, 2021): @minecraftchest1 this is what I got: > Created a new certificate valid for the following names 📜 > - "*.local" > Warning: many browsers don't support second-level wildcards like "*.local" ⚠️ > > Reminder: X.509 wildcards only go one level deep, so this won't match a.b.local ℹ️ > > The certificate is at "/Temp/Local/Certificate.pem" and the key at "/Temp/Local/Key.pem" ✅ > > It will expire on 25 November 2023 🗓 So, this is not practical.
Author
Owner

@gaby commented on GitHub (Sep 18, 2021):

This is not doable, you csn close the issue.

<!-- gh-comment-id:922278872 --> @gaby commented on GitHub (Sep 18, 2021): This is not doable, you csn close the issue.
Author
Owner

@harryqt commented on GitHub (Aug 4, 2022):

You could try mkcert *.local. That should do a catch-all for everything under .local tld.

This doesn’t work.

<!-- gh-comment-id:1205038205 --> @harryqt commented on GitHub (Aug 4, 2022): > You could try `mkcert *.local`. That should do a catch-all for everything under .local tld. This doesn’t work.
Author
Owner

@renatofrota commented on GitHub (Feb 11, 2024):

You can create a cert for *.dev.localhost. It works and should resolve internally.

app1.dev.localhost
app2.dev.localhost
etc...

will be all covered.

you can use anything else instead dev if you prefer. it is there just to make a 3rd level wildcard (instead a 2nd level one) and get accepted by browsers.

<!-- gh-comment-id:1937455068 --> @renatofrota commented on GitHub (Feb 11, 2024): You can create a cert for `*.dev.localhost`. It works and should resolve internally. app1.dev.localhost app2.dev.localhost etc... will be all covered. you can use anything else instead `dev` if you prefer. it is there just to make a 3rd level wildcard (instead a 2nd level one) and get accepted by browsers.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mkcert#253
No description provided.