Allow IP through htaccess using Cloudflare Proxy - apache

I'm using
Allow from 123.234.12.23
to whitelist IP addresses without needing to enter in the htpasswd credentials.
I've just switched to use Cloudflare proxy (to protect bypassing CF firewall) but now all requests to my server (from Apache logs) are coming in as Cloudflare IP's.
How can I access the requester's actual IP so that I don't have to keep entering in the credentials if I'm on a whitelisted IP?

To do this you need to install mod_cloudflare for Apache.
https://support.cloudflare.com/hc/en-us/articles/200170916-Restoring-original-visitor-IPs-Option-1-Installing-mod-cloudflare
Since my machine was running on Ubuntu, I ended up following the guide from this site which worked for me to install it on Ubuntu.

Related

How to enable HTTPS/SSL on XAMPP (Windows) using ngrok reverse proxy?

I am using ngrok to make my local instance of Apache (running through XAMPP on Windows 10) viewable to the internet. It works fine to access http://example.com but if I try https://example.com it gives me a certificate error (because the certificate is issued for its ngrok.io domain). I know I can avoid the cert error by using a url that ngrok generates for https, but I'd rather use my own domain name. How can I avoid the certificate error and get my site to load over https? I've seen a few guides for enabling https/ssl on localhost, but that's not what I need to do - I need to enable it for example.com, not localhost, and as I said, serving the site over http is working fine.

Remote access of network computer

I am not sure how or if this can be done. I have a home network and would like to see a computer,not the server, via a remote location. I have Apache on my server. Example: the network computers I would like to see ip 152.254.1.33. Is there a way to add this ip to Apache root directory? I have tried to add a shortcut with in the root directory and it only works on the home network, will not via remote connection.
I need some clarification here on what you are trying to acomplish, are you trying to access the Apache website outside of the local network?
If that is the case, Apache is automatically set to listen on all network interfaces, you can check this in your virtual host configuration in the sites-enabled directory of your apache installation.
You should see something like in the 000-default.conf
You can test if apache is serving pages up correctly using the command
curl 127.0.0.1
You should see the HTML of the page being served.
If this is the case, then it's likely the firewall on your machine/router or your ISP is blocking the required ports. You can allow Apache through the firewall on Ubuntu using sudo ufw allow Apache Full
If you give me some more info in comments we can probably work this out.

xampp Apache enable proxy for interent operations

I have followd this answer https://serverfault.com/a/249582 to enable proxy and put a line to forward internet operations. However, since I use http://localhost to browse my website, it also redirected localhost to the proxy server and thus my website cannot even load.
How can I bypass local addresses such as localhost, 127.0.0.1 or internal network IP such as 192.168.1.50, such that fopensock can work normally?

Enabling HTTPS on Domain

I have a vps running on ubuntu 12.04 with apache2. My question is, if I am going to install ssl cert and etc. to it am i able to use https directly to my domain? I just add A Record at my domain provider with the VPS IP Address.
Essentially, yes.
Remember to make sure that Apache is listening on https (and it's setup as it should be with the certs and mod_ssl) and if you have a firewall active, the port for https (443) is open.
Otherwise, all you would need to do is add your record to the DNS server.

Config Apache to Use VPS as a Browser Proxy

I am from a country with severe internet censorship. I want to surf the internet freely.
I have a VPS installed with CentOS5.5 and Apache 2 in U.S. Assume the VPS has the IP 12.34.56.78.
I want to config it as a browser proxy, like this: 12.34.56.78:8080. (I know how to use the ssh method, but I want to config the VPS as a browser proxy. Put 12.34.56.78:8080 in the browser Firefox, then I can surf the internet freely.)
I have found this link:http://www.vo1dmain.info/how-to-configure-private-proxy-on-vps.But It requires ssh client on your home computer. And I have dynamic IP, by the way.
Thanks a lot!
You can do it through Apache; the link you posted tells you how. Here's another one: http://www.enterpriseitplanet.com/networking/features/article.php/11315_3319671_1
And you have several options for your dynamic IP:
Order Deny, Allow
Deny from all
Allow from 192.168.1 .mcslp.pri
You can specify multiple entries made up for IP prefix, domain name, IP address subnets, and IPv6 addresses and subnets. As shown here, it is preferable to specify an IP address and domain, just to be sure (from the posted url).
And you'll need an ssh client... grab putty if you're on Windows.