Wordpress

79 views
Skip to first unread message

Joachim Richter

unread,
Mar 21, 2013, 1:23:47 PM3/21/13
to local...@googlegroups.com
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/50east
Plugin URI:     https://github.com/50east/wp-forwarded-host-urls
Version:        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]


Jeff Lindsay

unread,
Mar 21, 2013, 3:26:53 PM3/21/13
to local...@googlegroups.com
I'm not sure this would work because we don't add a HTTP_X_FORWARDED_HOST header. What we should be doing is rewriting the host if an option is giving to the client that this is needed.





--
You received this message because you are subscribed to the Google Groups "localtunnel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to localtunnel...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jeff Lindsay
http://progrium.com
Reply all
Reply to author
Forward
0 new messages