ryoluo / sail-ssl

Laravel Sail plugin to enable SSL (HTTPS) connection with Nginx.
MIT License
159 stars 15 forks source link

Add SSL_DOMAIN environment variable for custom Common Name #18

Closed michaelservidio closed 8 months ago

michaelservidio commented 1 year ago

Create environment variable SSL_DOMAIN (optionally set and pulled from value in .env) which will be used in server.pem creation.

Allows self-signed certificates to have a custom Common Name (instead of localhost, which would still be the default).

Use case: This allowed me to view my local application at https://mydomain.test by setting SSL_DOMAIN=*.mydomain.test in .env

michaelservidio commented 11 months ago

For Chrome to accept the certificate as valid, it required a subjectAlternativeName to be set. Added another variable, SSL_ALT_NAME, to specify (e.g. SSL_ALT_NAME=DNS:localhost,DNS:mydomain.test).

Updated README.md to explain both variables.