Welcome! Log In Create A New Profile

Advanced

help with replacing chars "_" to "." in a $variable

January 13, 2012 08:44AM
I would appreciate your help

I have to do the following request

http://subdomain_domain_extension_tdl.domain.com/

Where .domain.com must be deleted and subdomain_domain_extension_tdl must be converted to subdomain.domain.extension.tdl


I did this:

set $subdomain "";

if ($host ~* "^(.+)\.domain\.com$") {
set $subdomain $1;
break;
}

resolver 8.8.8.8;
proxy_pass http://$subdomain;
proxy_set_header X-Real-IP $remote_addr;


Then i get $subdomain as: subdomain_domain_extension_tdl but i need to transform it into subdomain.domain.extension.tdl

Could you please help me determining how could i do this? i would like to serve as proxy in this way:


If you want to get inside any blocked website like www.facebook.com be able to do it throug www_facebook_com.domain.com

Also i know that perhaps sometimes subdomain_domain_extension_tdl could be domain_extension_tdl,


Thanks in advance!
Andrés
Subject Author Posted

help with replacing chars "_" to "." in a $variable

andres-m77 January 13, 2012 08:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 129
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready