Ngrok: GET /wordpress/ 301 Moved Permanently

Created on 22 Feb 2016  路  8Comments  路  Source: inconshreveable/ngrok

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

HTTP Requests

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?

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

All 8 comments

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

  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

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

  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

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 :-)

Confirming that host-header=rewrite worked for me too! Thank you. No other plugins or steps were needed for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexforever86 picture alexforever86  路  5Comments

jabooth picture jabooth  路  5Comments

IngwiePhoenix picture IngwiePhoenix  路  7Comments

ricardoasc picture ricardoasc  路  5Comments

megapctr picture megapctr  路  4Comments