-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible Bug in HOST variable #520
Comments
F3's |
I just want to update this ticket for anyone having a simliar situation in the future. I have done some investigation and it appears. NGINX uses the first value of server_name in the nginx config file as the value for $_SERVER['SERVER_NAME']; so if you have an application like mine that uses sub domains dynamically and your NGINX server config has something like server_name = site.com *.site.com, your $_SERVER['SERVER_NAME'] and your f3 HOST variable will always be just site.com and not your sub domains, currently I can't figure out a way of getting the sub domain other than the HTTP_HOST variable. You can either do this in PHP or do it in your NGINX config file by setting somethign like this in your config file |
You really should be redirecting traffic from site.com to subdomain.site.com, else Google will give you a low SEO rating because they contain duplicate content. This can be done easily at the DNS level. |
for Google, site.com and www.site.com are 2 differents websites. Similarly, site.com and subdomain.site.com are flagged culprit of duplicate content (DC). The former is kept, the latter blackboxed. Gogogl's DC Law. |
Right. In summary, if |
I agree with what you are saying, but what I am building is more of an application than a content site. Google indexing is not needed, sub domains will be different unique indexes so the NGINX setup is valid. and the problem is a real problem, if i am not supposed to trust http_host than I am not sure how to dynamically allow sub domains, and get the correct domain |
@ChrisFrench can you rewrite the value of $_SERVER['SERVER_NAME'] before calling fatfree? // force rewrite of server var
$_SERVER['SERVER_NAME'] = 'monkeybone.com';
// Retrieve instance of the framework
$f3=require('lib/base.php');
echo $f3->get('HOST'); this worked for me using apache 2 |
I have an application that uses sub domains in various ways.
and I have found that using the latest build, and using NGINX, the f3 HOST var only contains the top level domain.
example my url is like
event1.site.com and the HOST variable is site.com
I have var_dumped my
$_SERVER
global and I get theSERVER_NAME= site.com
andHTTP_HOST = event1.site.com
not that both the subdomain and and the top level domain are all mapped to the same f3 instance.
The text was updated successfully, but these errors were encountered: