Hi guys,
I just found out about localtunnel and I love it... I am running it on UBUNTU. Wordpress is the big problem the URLs in particular. I have done a bit of digging
and I run into a website that basically offers the same functionality that localtunnel does, but for money, they have solved the wordpress problem with the following code,
I think this would solve the wordpress and localtunnel issue, problem is localtunnel does not send any specific headers, as far as I have checked ... this piece of code
is a so called wordpress plugin. is there any way one can adapt this to work with localtunnel v1 ?
[code]
<?php
/*
Plugin Name: Forwarded Host URLs
Description: Forces WordPress to build urls using the X-Forwarded-Host header, if it exists.
Author: blahed, nwah
Author URI:
https://github.com/50eastPlugin URI:
https://github.com/50east/wp-forwarded-host-urlsVersion: 0.0.3
*/
function has_forwarded_host() {
return array_key_exists('HTTP_X_FORWARDED_HOST', $_SERVER);
}
function forwarded_host() {
return $_SERVER['HTTP_X_FORWARDED_HOST'];
}
function forwarded_base() {
$_forwarded_host = forwarded_host();
return "//$_forwarded_host";
}
function apply_forwarded_host() {
if ( !has_forwarded_host() )
return false;
else
return forwarded_base();
}
function replace_with_forwarded_host($url, $path = '') {
if ( !has_forwarded_host() )
return $url;
else
return preg_replace('!https?://[a-z0-9.:-]*!', '//' . forwarded_host(), $url);
}
function cancel_canonical_redirect() {
return false;
}
add_filter('pre_option_home', 'apply_forwarded_host');
add_filter('pre_option_siteurl', 'apply_forwarded_host');
add_filter('pre_option_url', 'apply_forwarded_host');
add_filter('stylesheet_uri', 'replace_with_forwarded_host');
add_filter('admin_url', 'replace_with_forwarded_host');
add_filter('template_directory_uri', 'replace_with_forwarded_host');
add_filter('redirect_canonical', 'cancel_canonical_redirect');
?>
[/code]