-1

So, okay I want to only accept requests from my web host to my server, I only want to allow either my servers domain name, or my servers ip my server also uses cloudflare.

So I only want to grant access to one or more of my servers & using CloudFlare at the same time, how might this be approached?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Somenoob
  • 27
  • 1
  • 5
  • 4
    Are you using CF or PHP? – John Conde Jan 08 '14 at 20:37
  • CF http://stackoverflow.com/questions/830782/in-coldfusion-is-there-a-way-to-determine-what-server-the-code-is-running-on, PHP http://stackoverflow.com/questions/1408996/best-way-to-get-hostname-with-php – Mike B Jan 08 '14 at 20:38
  • @JohnConde mikeB I ment cloudflare the DDoS protection reserve proxy for nameserver service.. – Somenoob Jan 08 '14 at 20:43

1 Answers1

1

You can use the $_SERVER variable, using SERVER_NAME;

$_SERVER['SERVER_NAME'];

As described in the documentation:

'SERVER_NAME' The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.

You are, however, reliant on a server config file (httpd.conf) to achieve this.

<VirtualHost *>
    ServerName example.com
    UseCanonicalName on
</VirtualHost> 

The UseCanonicalName directive seems to be on to solve a known bug (More).

Community
  • 1
  • 1
Jonast92
  • 4,964
  • 1
  • 18
  • 32