Skip to content

Commit bfe95c2

Browse files
♻️ Refactoring secure proxy stub. Fixing SiteTest.
1 parent 3098f5f commit bfe95c2

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

cli/stubs/secure.proxy.valet.conf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
server {
44
listen 127.0.0.1:80;
5+
#listen VALET_LOOPBACK:80; # valet loopback
56
server_name VALET_SITE www.VALET_SITE *.VALET_SITE;
67
return 301 https://$host$request_uri;
78
}
89

910
server {
1011
listen 127.0.0.1:443 ssl http2;
12+
#listen VALET_LOOPBACK:443 ssl http2; # valet loopback
1113
server_name VALET_SITE www.VALET_SITE *.VALET_SITE;
1214
root /;
1315
charset utf-8;
@@ -53,3 +55,38 @@ server {
5355
deny all;
5456
}
5557
}
58+
59+
server {
60+
listen 127.0.0.1:60;
61+
#listen VALET_LOOPBACK:60; # valet loopback
62+
server_name VALET_SITE www.VALET_SITE *.VALET_SITE;
63+
root /;
64+
charset utf-8;
65+
client_max_body_size 128M;
66+
67+
add_header X-Robots-Tag 'noindex, nofollow, nosnippet, noarchive';
68+
69+
location /VALET_STATIC_PREFIX/ {
70+
internal;
71+
alias /;
72+
try_files $uri $uri/;
73+
}
74+
75+
access_log off;
76+
error_log "VALET_HOME_PATH/Log/VALET_SITE-error.log";
77+
78+
error_page 404 "VALET_SERVER_PATH";
79+
80+
location / {
81+
proxy_pass VALET_PROXY_HOST;
82+
proxy_set_header Host $host;
83+
proxy_set_header X-Real-IP $remote_addr;
84+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
85+
proxy_set_header X-Forwarded-Proto $scheme;
86+
}
87+
88+
location ~ /\.ht {
89+
deny all;
90+
}
91+
}
92+

tests/SiteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public function test_add_non_secure_proxy()
373373
{
374374
$config = Mockery::mock(Configuration::class);
375375
$config->shouldReceive('read')
376-
->andReturn(['tld' => 'test']);
376+
->andReturn(['tld' => 'test', 'loopback' => VALET_LOOPBACK]);
377377

378378
swap(Configuration::class, $config);
379379

0 commit comments

Comments
 (0)