Author Topic: Prevent direct IP access/Facebook crawling  (Read 2979 times)

0 Members and 1 Guest are viewing this topic.

Offline alfablac

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Prevent direct IP access/Facebook crawling
« on: August 14, 2015, 02:06:17 AM »
I'm currently running HFS to host a static page (and some download folders).
Is there any setting in HFS to prevent direct IP accesses? Let me say, my IP is xx.xx.xx.xx,
I don't want it to open the index.html static page if I browse it using http://xx.xx.xx.xx
or, in other words, I want the server to be acessible only by using http://domain.com
Apache usually have that .htaccess that can rule over direct IP accesses preventing this to happen.

--

Second question.
I put the meta tags and opengraph tags in the html, just to be able to share some links on facebook with thumbnails and such things.
I'm running through CloudFare's DNS. Is that a problem? Because the crawler doesn't seem to get the html file.
It keeps giving timeout errors on https://developers.facebook.com/tools/debug/og/object/

EDIT: BTW, since this is my first post, thanks for HFS! It's the best tool for casual users!

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 848
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
Re: Prevent direct IP access/Facebook crawling
« Reply #1 on: August 15, 2015, 09:37:47 PM »
first section is chaining ip address to names, requires you to do some work and most lilky go after a free dynamic dns name...

http://freedns.afraid.org/

create and account:
http://freedns.afraid.org/signup/

create a sub domain type A *which is %what you want here%.%freedns pucli server like mooo.com% to (public ip adress)
find you public ip adress here: http://www.ipchicken.com/
you may need a new dns updater:
http://freedns.afraid.org/scripts/freedns.clients.php

(if you use your dynamic ip for more tham web traffice:)
when seting up your new dns domain name
got to sub domains http://freedns.afraid.org/subdomain/
add input info, Public ip should be there, if not type it in, clik on explanation if you need more info, for a dynamic name to ip you will need a type A

(if you just need web forward dns to ip:
when seting up your new dns domain name
got to web forwards: http://freedns.afraid.org/redirect/


( it will be a while before it takes effect and you may need to just create and delte and recreate)
I use hfs as web and https, and i have a working combo with a sub domain and a web redirect
(the names can't be the same... its one or the other)

in HFS, you will have to do some fiddeling, but ti add you dns name to hfs
go to the menue >ip adress > custum
input your new dns,, and then clcuk ok, then go back to menue >ip adress > %you dns hostname%

all expereience may differ, this is just 1 way for thoses on dyndns to stil recieve what they need if not more, as dyndns is officaly shuting down the free side.
-------------
Second post...
not familar with " cloud fiar DNS, and unkwon on FaceBook setting, could easly be the new security with FB and shared loinks / is the FB link "PUIBLIC!"

hope this helps :9
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline LeoNeeson

  • Tireless poster
  • ****
  • Posts: 579
  • Solitario...
    • View Profile
    • twitter.com/LeoNeeson
Re: Prevent direct IP access/Facebook crawling
« Reply #2 on: August 17, 2015, 08:05:19 AM »
EDIT: BTW, since this is my first post, thanks for HFS! It's the best tool for casual users!
Hi! and welcome! :)

first section is chaining ip address to names, requires you to do some work and most lilky go after a free dynamic dns name...
I'm sorry bmartino1, but I think you misunderstood the whole point of his question. He wants to allow access to his HFS Server, "only" through a domain name (which he already has), and "not" by typing his IP address.

For example, let's imagine that the IP address of your HFS Server is "200.123.001.123", and he has already this domain "test123.no-ip.com" pointed to that IP. So, he wants to forbid access to his HFS Server, if someone try to access through his own IP address, and not by his domain. Let's make this more graphical:

If some random user wants to access the HFS Server through....
Code: [Select]
http://200.123.001.123/ -----> The files must be not be served by HFS
http://test123.no-ip.com/ -----> The files will be served normally by HFS

I don't know the solution for this, sorry. But it's an interesting question indeed. I think this is something that must be internally programmed inside HFS (if it's not already in). Maybe rejetto, SilentPliz, Mars or raybob knows more about this... Sorry... :(

alfablac: About your second question, I think it doesn't matter if you use CloudFare's DNS, since your DNS resolution doesn't have anything to do with Facebook's internal DNS resolution (DNS are more a "client" setting, than a "server" setting, if I'm not wrong). Maybe I misunderstood your question... ???
« Last Edit: August 17, 2015, 08:10:30 AM by LeoNeeson »
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
• I'm open to help and share any file you may need (just ask me) ;)

Offline bmartino1

  • Tireless poster
  • ****
  • Posts: 848
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
Re: Prevent direct IP access/Facebook crawling
« Reply #3 on: August 17, 2015, 12:49:42 PM »
i'm not 100% sure of what is being asked also, to my understanding, you didn't have the DNS to ip setup correctly...

If you can go outside of you network and use a domain name to access you HFS public IP, then we need to do things on your Facebook account to share the link...

http://www.wikihow.com/Post-Links-on-Facebook
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12949
    • View Profile
Re: Prevent direct IP access/Facebook crawling
« Reply #4 on: August 22, 2015, 10:58:23 AM »
welcome!
easy solution:
ALT+F6
paste this rule, customizing the "localhost:8080" part to be the domain you want (port included, if different than 80)

[+request]
{.disconnection reason|you fool|if={.{.header|host.} != localhost:8080.}.}
« Last Edit: August 22, 2015, 11:14:22 AM by rejetto »

Offline alfablac

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Re: Prevent direct IP access/Facebook crawling
« Reply #5 on: August 27, 2015, 05:11:06 AM »
welcome!
easy solution:
ALT+F6
paste this rule, customizing the "localhost:8080" part to be the domain you want (port included, if different than 80)

[+request]
{.disconnection reason|you fool|if={.{.header|host.} != localhost:8080.}.}

The forums server was throwing me PHP errors the other day that I almost forgot about it.
This solution is great! But... I did as you said:
[+request]
{.disconnection reason|you fool|if={.{.header|host.} != domain.com.}.}

But now I can only access the index page, in the case, http://domain.com/.
Every folder and file inside the "/" folder is throwing me the you fool page.
Also, I can't access www.domain.com and folders/subfolders...
I guess I need go a little further on these commands.

EDIT:
Actually I was adding another line like this:
[+request]
{.disconnection reason|you fool|if={.{.header|host.} != domain.com.}.}
{.disconnection reason|you fool|if={.{.header|host.} != www.domain.com.}.}

and it is preventing to access the folders.
I want to give access to the www.domain.com access too.
If that matters, Cloudfare redirects (or something) www.domain.com to the SSL https://www.domain.com/
« Last Edit: August 27, 2015, 05:19:01 AM by alfablac »

Offline LeoNeeson

  • Tireless poster
  • ****
  • Posts: 579
  • Solitario...
    • View Profile
    • twitter.com/LeoNeeson
Re: Prevent direct IP access/Facebook crawling
« Reply #6 on: August 27, 2015, 07:05:02 AM »
For HTTPS: Adding another line like this, works? (domain.com:443)
Code: [Select]
{.disconnection reason|you fool|if={.{.header|host.} != www.domain.com:443.}.}
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
• I'm open to help and share any file you may need (just ask me) ;)

Offline alfablac

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Re: Prevent direct IP access/Facebook crawling
« Reply #7 on: August 27, 2015, 11:20:37 AM »
For HTTPS: Adding another line like this, works? (domain.com:443)
Code: [Select]
{.disconnection reason|you fool|if={.{.header|host.} != www.domain.com:443.}.}

Tested one line with domain.com and it only access via http://domain.com
Tested one line with www.domain.com and it only access via https://www.domain.com
Anything with 2 lines... none of them works. I know there's probably a one line answer reading the scripts page,
but I couldn't make the or and if commands work. =/

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12949
    • View Profile
Re: Prevent direct IP access/Facebook crawling
« Reply #8 on: August 28, 2015, 11:47:24 AM »
should be something like
{.disconnection reason|you fool|if={.not|{.pos|domain.com|{.header|host.}.}/not.}.}


the /not is just for readability.

When you were using the "double" command, you were saying to disconnect in both case, indeed.

Offline alfablac

  • Occasional poster
  • *
  • Posts: 11
    • View Profile
Re: Prevent direct IP access/Facebook crawling
« Reply #9 on: August 28, 2015, 12:14:54 PM »
should be something like
{.disconnection reason|you fool|if={.not|{.pos|domain.com|{.header|host.}.}/not.}.}

the /not is just for readability.

When you were using the "double" command, you were saying to disconnect in both case, indeed.

Awesome rejetto! My life is complete.