I use ngrok http tunnel to view my web designs on various devices. Recently I set up a wordpress development environment which all works fine. However, when I try to view using ngrok http tunnel the website loads for 20odd seconds then times out. The ngrok console spits out the following:
ngrok by @inconshreveable (Ctrl+C to quit)
Tunnel Status online
Version 2.0.19/2.0.20
Web Interface http://127.0.0.1:4040
Forwarding http://d33d0eff.ngrok.io -> localhost:8080
Forwarding https://d33d0eff.ngrok.io -> localhost:8080
Connections ttl opn rt1 rt5 p50 p90
4 0 0.00 0.01 5.18 8.27
GET /wordpress/ 301 Moved Permanently
GET /favicon.ico 200 OK
GET /icons/image2.gif 200 OK
GET /icons/text.gif 200 OK
GET /icons/folder.gif 200 OK
GET /icons/blank.gif 200 OK
GET / 200 OK
Is there a way around this?
It's hard to say without knowing more about what's going on. Please contact email [email protected], github will be exclusively for ngrok 1.X issues.
The following steps worked for me
1) Update ngrok (Ctrl+u when ngrok is running)
2) adding the following two lines to wp-config:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
3) Installing https://wordpress.org/plugins/relative-url/ in Wordpress
@thorsten-stripe Thank you for providing the solution! The site loaded the site, however the css and other absolute links don't load.
The source code on my local machine shows relative urls, however viewing the source in android on chrome shows absolute urls.
Note this can be done by adding view-source: at the start of a URL, ie:
http://d33d0eff.ngrok.io becomes view-source:http://d33d0eff.ngrok.io
Thanks @thorsten-stripe, I added those two lines, activated relative-url plugin and it worked fine, after that I deactivated relative-url plugin but its still working, Is that possible ?
its not work with multisite
The following steps worked for me
- Update ngrok (Ctrl+u when ngrok is running)
- adding the following two lines to wp-config:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);- Installing https://wordpress.org/plugins/relative-url/ in Wordpress
Oh my got after so many tries I found this advice with this plugin and IT WORKS. It finally works... Neither of the else plugins worked, not defining absolute WP_SITEURL/HOME, not changing database... Just these 2 lines, this relative-url plugin and ngrok with command ngrok http -host-header=rewrite wp.myserver and voila. Thank you so much :-)
I have the same, issue while using SSL, I added these two lines but and even replaces HTTP with HTTPS but nothing changed. I'm using an auto-generated SSL certificate from Laragon local server.
The following steps worked for me
- Update ngrok (Ctrl+u when ngrok is running)
- adding the following two lines to wp-config:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);- Installing https://wordpress.org/plugins/relative-url/ in Wordpress
Oh my got after so many tries I found this advice with this plugin and IT WORKS. It finally works... Neither of the else plugins worked, not defining absolute WP_SITEURL/HOME, not changing database... Just these 2 lines, this relative-url plugin and ngrok with command
ngrok http -host-header=rewrite wp.myserverand voila. Thank you so much :-)
Confirming that host-header=rewrite worked for me too! Thank you. No other plugins or steps were needed for me.
Most helpful comment
The following steps worked for me
1) Update ngrok (Ctrl+u when ngrok is running)
2) adding the following two lines to wp-config:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);3) Installing https://wordpress.org/plugins/relative-url/ in Wordpress