Reputation: 1186
Been trying to share the local site using a temporary url https://xxxxx.ngrok.io running with Laravel Valet. When I run Valet version 1.1.22:
valet --version
Laravel Valet version 1.1.22
securely the ngrok url leads to a connection refused. When it is unsecure it leads to connection refused as well (404 only with valet running on the secondary machine as it wouldn't be found there). Either that or a DNS resolving issue as I mention later on.
Locally on my wifi network and on the PC is works just fine. Access logs show me this:
127.0.0.1 - [03/Oct/2016:08:57:06 +0300] "POST /server.php?doing_wp_cron=1475474226.5450510978698730468750 HTTP/1.1" 200 0
127.0.0.1 - [03/Oct/2016:08:57:07 +0300] "POST /server.php HTTP/1.1" 200 47
127.0.0.1 - [03/Oct/2016:08:59:09 +0300] "POST /server.php?doing_wp_cron=1475474348.8563120365142822265625 HTTP/1.1" 200 0
127.0.0.1 - [03/Oct/2016:08:59:10 +0300] "POST /server.php HTTP/1.1" 200 47
Still do not see an error related to refused connection in this log at ~/.valet/Log/access.log . Error logs show old errors, not related to this issue. Ngrook window in terminal shows 301 Moved permanently on the two loads I just tried. Ngrok status site http://localhost:4040/status showed me:
GET / HTTP/1.1
Host: site.dev
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.8 (KHTML, like Gecko) Version/9.1.3 Safari/601.7.8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-us
X-Forwarded-For: xx.xx.xx.xxx
X-Forwarded-Proto: https
X-Original-Host: xxxxxx.ngrok.io
and then the redirect:
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Location: http://mysite.dev/
Server: Caddy
Status: 301 Moved Permanently
X-Powered-By: PHP/7.0.11
X-Ua-Compatible: IE=edge
Date: Mon, 03 Oct 2016 06:14:10 GMT
Content-Length: 0
Caddyfile here for completion (generated by Valet):
import /Users/jasper/.valet/Caddy/*
:80 {
fastcgi / 127.0.0.1:9000 php {
index server.php
}
rewrite {
to /server.php?{query}
}
log /Users/jasper/.valet/Log/access.log {
rotate {
size 10
age 3
keep 1
}
}
errors {
log /Users/jasper/.valet/Log/error.log {
size 10
age 3
keep 1
}
}
}
Ngrok is running too (added after tld domain was changed to .localhost):
ps aux | grep ngrok
jasper 1260 0.0 0.2 556735952 28692 s001 S+ 10:23AM 1:27.14 /Users/jasper/.composer/vendor/laravel/valet/bin/ngrok http -host-header=rewrite site.localhost:80
root 1254 0.0 0.1 2463108 8964 s001 S+ 10:23AM 0:00.01 sudo -u jasper /Users/jasper/.composer/vendor/laravel/valet/bin/ngrok http -host-header=rewrite site.localhost:80
jasper 3557 0.0 0.0 2432804 2096 s000 S+ 2:36PM 0:00.00 grep ngrok
So it does hit the Caddy Server and the ngrok status does show that. But it then does a redirect which translates into a connection refused or DNS resolution problemns for the browsers.. So what is the issue here?
Upvotes: 2
Views: 3090
Reputation: 1186
In the end I realized WordPress was creating an extra redirect using its permalink structure. So when you turn off permalinks you can share your Laravel Valet WordPress site to the outside world using Ngrok. Not the perfect solution, but at least one that works and that allows you to show your work in progress to clients running it on your local machine.
Upvotes: 1