1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 16:40:05 +01:00

🚚 Use insecure instead of unsecure.

This commit is contained in:
Mikaël Popowicz
2021-04-26 18:00:33 +02:00
parent b64b9bd81a
commit 7fdcdd3544
3 changed files with 11 additions and 11 deletions

View File

@@ -710,10 +710,10 @@ function unsecureAll()
*
* @param string $url The domain name to serve
* @param string $host The URL to proxy to, eg: http://127.0.0.1:8080
* @param bool $unsecure
* @param bool $insecure
* @return string
*/
function proxyCreate($url, $host, $unsecure = false)
function proxyCreate($url, $host, $insecure = false)
{
if (!preg_match('~^https?://.*$~', $host)) {
throw new \InvalidArgumentException(sprintf('"%s" is not a valid URL', $host));
@@ -726,7 +726,7 @@ function proxyCreate($url, $host, $unsecure = false)
$siteConf = $this->replaceOldLoopbackWithNew(
$this->files->get(
$unsecure ? __DIR__.'/../stubs/proxy.valet.conf' : __DIR__.'/../stubs/secure.proxy.valet.conf'
$insecure ? __DIR__.'/../stubs/insecure.proxy.valet.conf' : __DIR__.'/../stubs/secure.proxy.valet.conf'
),
'VALET_LOOPBACK',
$this->valetLoopback()
@@ -738,13 +738,13 @@ function proxyCreate($url, $host, $unsecure = false)
$siteConf
);
if ($unsecure) {
$this->put($url, $siteConf);
if ($insecure) {
$this->putInsecurely($url, $siteConf);
} else {
$this->secure($url, $siteConf);
}
$protocol = $unsecure ? 'http' : 'https';
$protocol = $insecure ? 'http' : 'https';
info('Valet will now proxy ['.$protocol.'://'.$url.'] traffic to ['.$host.'].');
}
@@ -775,7 +775,7 @@ function proxyDelete($url)
* @param string $siteConf pregenerated Nginx config file contents
* @return void
*/
function put($url, $siteConf)
function putInsecurely($url, $siteConf)
{
$this->unsecure($url);

View File

@@ -1,4 +1,4 @@
# valet stub: proxy.valet.conf
# valet stub: insecure.proxy.valet.conf
server {
listen 127.0.0.1:80;

View File

@@ -210,13 +210,13 @@
/**
* Create an Nginx proxy config for the specified domain
*/
$app->command('proxy domain host [--unsecure]', function ($domain, $host, $unsecure) {
$app->command('proxy domain host [--insecure]', function ($domain, $host, $insecure) {
Site::proxyCreate($domain, $host, $unsecure);
Site::proxyCreate($domain, $host, $insecure);
Nginx::restart();
})->descriptions('Create an Nginx proxy site for the specified host. Useful for docker, mailhog etc.', [
'--unsecure' => 'Create a proxy without SSL'
'--insecure' => 'Create a proxy without SSL'
]);
/**