Disable domain IP caching - caching

I have have few projects that I'm holding on one of my VPS from DigitalOcean. In order to keep them up even my VPS may come down, I bought another VPS from DigitalOcean with idea to sync the projects on both server, so if the main goes down the second will take the lead.
So I set a Cronjob, on the second server, that is checking the projects state on the main, and in case the response is negative, using the DigitalOcean API I change the domain A record to to direct to the second server, until the problem on the main server is not fixed.
I was afraid that the IP propagation will take too much time, but it seems to do it very fast.
Instead there is another problem. It seems the computer is caching the IP address, so it still direct to the main server.
I tested this with few computers and with service like HideMyAss.
Question: Is there a way I can tell from my server to the client that the IP is changed or to not cache my IP?
Thank you

Related

socks5 proxy: enable for only certain IPs

I have a webpage and a little game server running on my own machine that is located at my work office.
The problem is that some people can't reach the webpage and game server, because of some network issues. The reasons are not the key, just take it (for almost all my community all things works fine, there just some troubles for a specific group).
So,
I have set up the test Droplet on Digital Ocean, with socks5 proxy installed.
https://github.com/hensly/socks5
And it all worked :) Clients that are restricted to connect directly are just using my proxy server to connect to the webpage or game server.
.
So my questions come up:
How can I limit my proxy to work only with certain IPs? Actually, I need only one IP - the IP of my server-pc, and that's it (the reserved (white) IP and domain name attached to it). Is there a way of such limitation on the proxy side? I just don't want them to use proxy for everything (mostly because there is not an unlimited Bandwidth and it could cost some extra).
Thanks <3
p.s. if you know other, more convenient ways to solve my problem, I'd appreciate it if you share your thoughts.

Not sure how to set up my dns and heroku apps to do what I want

Heroku offers US and EU servers and I want my users to connect to the server which is closer to them, so if someone connects from the EU, I will redirect them to the EU server and the same for the US.
My idea was to have them connect to main domain name, example.com that would connect to the US server, which would check where the users are coming from, and then redirect them to where I want them to be, and all this while they are looking at the same domain "example.com". Heroku wont let me add the same domain twice, and I don't know where I should configure what for the DNS. My domain provider has a nameserver section and I'm not sure what to add there. Basically I want all the request and server load to go onto the Heroku page, and not onto the default DNS server which only redirects or loads the Heroku page inside a frame.
They way it seems correct, is to connect to example.com, which is the US Heroku page and then redirect inside a frame or something to the EU page... not sure if this is the best way, and like I mentioned, I'm not sure how to setup the namespace and stuff so they connect directly to the Heroku server instead of the default domain server.
Could someone explain to me what I need to do to achieve what I want?
It is currently not possible to run a multi-region application on Heroku and I'd caution against trying to work your way around this limitation. Some areas that cause users problems when trying to attempt this are:
You can't have the same custom domain on two apps (as you've already identified).
There is no way to setup a multi-master database configuration so each app has a db in its own region. Likewise, maintaining a single master for both apps results in very high latency for one of the apps.
The connection overhead of any other trickery, like what you propose here, often negates any latency improvement the user sees from accessing the app in their closest region.
Using a CDN for static assets, and having a proper http cache header strategy often gets you 90% of the way to the performance of a truly geo-distributed app.
To drill further into your question, I'm not sure what you mean here?
how to setup the namespace and stuff so they connect directly to the Heroku server instead of the default domain server
Hope that helps!

DNS, A Record set up, mail server on one server, site hosted on another

I am taking control of a clients website for them from the previous developers.
I am not that familiar with A records and anything more than basic hosting set up, and a bit concerned I may break things so seeking some advice.
The mail is currently hosted on with the host easily, and I've been told the actual sites files are hosted on an external server which is controlled by the A record. Since the A record points to an external server.
I have set up a new cpanel account for the existing domain on my own VPS and would like to clarify that changing the A record IP address to that of my VPS would point the domain to my server hosting the new site.
Here is a screenshot of the existing DNS setup in the easily control panel.
http://wilford.gemnetworks.com/easily.png
Many thanks,
David
just change the ip of the A record if you want to change server

Directing dynamic subdomains to particular servers

We're building a multitenant SAAS app. Each customer gets its own subdomain, http://customername.mycompany.com. Each customer will have many gigabytes of data, which means that they have to be assigned to a particular server and stay there.
If I have a server farm, and a request comes in for a particular customer, how do I direct the request to the right server?
My thought is that I'll have to create some kind of custom, programmable load balancer that will know where each customer lives and proxy the request through.
Is there an easier way?
If not, where do I find such a load balancer? The ones I've found online act more like appliances than applications which could go query a database to find the right destination server.
I think the answer is in the question; you mention that the user will connect to username.mycompany.com. So use a DNS A record to point them to a particular IP.
In the future, if you wanted to load balance the user across (say 2) servers, you could create a virtual IP on a load balancer appliance (running LVS for example), and then point the A record to the Virtual IP created by the LB, and distribute the user across a group of servers that you have configured.
This is why using subdomains is simpler than having URL based access such as company.com/username, in which case you would have to inspect the content of the packet to see the requested URL. By using subdomains, everything can be done at the IP layer.

My IP seems to be blocked by web hosting server

I have a strange problem, I just installed my php web site on a shared hosting, all services were working fine. But after configuring my app I just could visit my web site only once, other attempts gives:
"The server is taking too long to respond.".
But from other IP i can access, but only once, it seems all ip addressess beeing blocked after first visit(even ftp and other services get down, no access at all from the IP), can anyone help to explore this problem ? I don't think that it's my app problem, the app works fine on my local PC.
Thanks.
First thing to try would be a traceroute to determine where your traffic is being blocked.
In a windows command prompt:
tracert www.yoursharedhostingserver.com
At the moment, trying to access this address gives this:
Fatal error: Class 'mainController'
not found in
/home/myicms/public_html/core/application/crApplication.class.php
on line 181
I have tried it multiple times and it didn't block me. It might be that You have already solved this problem.
As far as I know, the behavior described by You could only be explained by a badly configured intelligent firewall. It may have been misconfigured by Your host.
If You visit a site at a certain host and suddenly You cannot access an ftp on this host, then it's either a (really bad) firewall or a (very mean) site that explicitly adds a firewall rule to ignore that address.
Some things that You might look into:
It might be something with identd too. What was the service You have configured on Your host? Was it by any chance any kind of server-controll panel (that might have an ability to controll a firewall)?
Is the blockade permanent, or does it go off after 24h, or does it only go off after rebooting the server? Does restarting some services makes the blockade go off?
Did You install any software that "protects Your server from portscanning"? It might be a bit too aggressive.
I wish You good luck in finding a source of this problem!
Chances are that if you can access it once that its actually working. The problem is more than likely in the php code than in the server.

Resources