Prevent direct access to IP

I connect my server on aws to cloudflare to redirect all request coming to mini-soc.com to my IP (3.19.x.x) .
But when I access the IP directly it bypass all cloudflare. so how could I prevent direcct access to IP (3.19.x.x) or redirect all 3.19.x.x to mini-soc.com on cloudflare?

Basically, you need to make sure your instance has a security group that prevents access to port 80 and 443 unless the IP is a cloudflare IP. I wrote a blog post on this:

Here’s the AWS method

1 Like

I tried your method but the website stopped at all from URL and IP
so how can complete with your method?

Regards.

Abdulghani Alkhateeb

I used these IPs list

to permit them on my server IP AWS security group rule, But I cannot browse my website min-soc.com now can anyone help my how can I fix that?

I deny all http and https to browse and permit the cloudflare IPs as mentioed.

:wave: @abdulghanikhateeb,

min-soc.com is not a registered domain.

-OG

1 Like

I did that on group policy but the site deosn’t open after that
how to fix that?

where isn’t registered?
this is my own or is there anywhere else to register?

A Whois search for that domain returns no results. Nor do DNS queries return anything.

1 Like

There is no domain hosing. I bought domain and link it to AWS instance server.
the website works perfectly but when I deny all IPs and prevent cloudflare range only to browse through http/https its stopped.

Change Crypto SSL to Full or Full Strict

I did, But if the user enter 3.19.x.x that is my AWS static IP it will bypass all cloudflare DNS and go forward to the server so in this case the full strict SSL won’t help. Am I right?

Regards.

Abdulghani Alkhateeb

That is correct. Your SSL setting will do nothing to prevent direct access via your IP address.

1 Like