Reroute web traffic. Act as gateway - redirect

In hotels WiFi is unprotected and everyone can connect. But no matter the requested url you are redirected to their "Give a password" page.
I am interested in making something similar but I'm kinda lost. I don't know where to start.
What is the minimum hardware required for such thing, do I have to buy a special router that does this or I can simply get a computer with Apache or IIS and manage traffic from there?
edit:
Since second scenario is more likely to be the answer, I am looking for some info on where to start.

Related

Site is not accessible by webscrapers

The website I am using is being scraped with wrong information. (metatag checker) Namely the information when looking for a domain of my hosting company (my host name service provider). I can totally not understand why. I want to be able to share my site on social media but somehow it is not available. I really don't know what is going on.. Can someone please help?
The following links show what I mean:
https://rankingapp.metatags.nl/nl/reports/mysite.nl
https://developers.facebook.com/tools/debug/sharing/?q=www.mysite.nl
And this is my website: http://www.mysite.nl
Facebook prefers IPv6 over IPv4 when available, and in the debug tool output you see
Server IP: 2a02:2268:ffff:ffff::4
So go check/have checked that your DNS configuration is correct.
Having the DNS wrongly resolve the IPv6 address of the domain to the "main domain" of a shared(?) hosting account is a common cause for such problems. End users are still largely "on IPv4" when they're browsing the net, so real users hardly ever notice such issues - but when the Facebook scraper comes along and wants to request the page via IPv6, it goes wrong ...

How to redirect a website according to country's IP address

I'm working on a messenger app whose server side code is developed in Erlang.
The problem which I'm facing is regarding redirection of website according to country specific domain.
For example: when user's types google.co in message box, it automatically displays google.co.uk, how can I redirect it to google.co.in if I'm in India?
For finding country's location, I found this library on github: https://github.com/mochi/egeoip
How can I use this geoLocation for redirecting to particular country specific website?
ScreenShot, when I entered facebook.com, it automatically displays preview in my local language.
But in case of my app, it shows preview in some foreign language, russian maybe.
I've read the comments, and since you are not considering having datasets as an option, I think what you may want to do is something like this:
First thing to understand is how those previews work. In any (popular) messaging app, if you type in a URL, the app will send a request to the URL and get the website metadata. Then it will be displayed in the UI.
The country detection, is a bit more complicated and done in a variety of ways. But thankfully, you (almost) don't have to do anything. This is a rather long topic, but I'll try to shorten it out.
Text Localization
In some websites (might be the case of Facebook's in your example), they do country detection on the application layer, and then based on that country, it will use a specific language for the website's text. This all usually happens before the website renders it's content, so you do not have to worry about it.
GeoDNS
This one occurs on the DNS layer, and probably the most popular. Domain names can be assigned a handful of IP addresses. These IPs can point to different versions of the website, and in the case of GeoDNS it will be up to the DNS manager to assign a country to an IP. So when a DNS query came from Russia, the requesting IP's country will be resolved and then the IP assigned to it (if any) will be returned. This is used by websites especially for country-specific features or content. Best example is Netflix.
Redirects
In case of Google redirecting you to a different domain, this might be how they do it. Country is being resolved via the IP address in the application (HTTP) layer, and then does a 301/302 redirect, pointing to the new domain name. This one, you may need to do something on. So given that your application needs to do an HTTP request to the URL the user has entered, if it returns a redirect, you must follow it. Many HTTP libs/clients already does this, but on some you might have to explicitly turn on the option to follow redirects.
One important thing to note is to do the HTTP request on the client side. Otherwise, you will be resolving to the same country (where your server resides) regardless of where your user is.

How can I show a maintenance page when my web server is down or completely powered off?

I work for a company which has its own web server they are due to have a complete power blackout over the weekend, meaning their servers will be down.
Does anyone know a way we could present a down status on a maintenance page or some kind of redirect so we can at least inform our users that the site is down for maintenance and not just missing/broken?
The best way is probably setting up a redirection to dummy server on your load balancer or border routers. If you have no such thing, then you can either try asking your provider about the options, or temporarily change the DNS record, provided that you reduce DNS cache timeouts before and after the change, so it takes effect immediately.
Set up a server on another location and point their domains DNS record to that server during the blackout.
The redirect has to be carried out by the web server. No web server, no redirect. What you can do is to get another web site by a web hosting company (which will not be subject to your blackout), and configure it to route requests from your main dns to the temp site with just a plain notice html page, then remove it once power is restored. This can be done if you have the dns info from the primary site. You could also mirror the site this way, and then shut down the mirror and no one will be the wiser. Try http://siteground.com I have used them for years.
If you are using a load balancer, see if it supports a "Sorry Server" page. Most of them have this feature built in.

Are there any dedicated SMTP/POP providers for a top level domain, SaaS web application

We are in the process of building a Multi-Tenant, SaaS type web app. Everything is set to go on the application part but when it comes to email there is a problem.
Each tenant/user of the application has a subdomain based account. However, there will be the option for that tenant to associate a top level domain to their account. Here is where the problem comes for us.
Basically, if the user sets up their DNS to point to our SaaS web app everything works good on the app front except that it now makes us responsible for handling their Email as well. Incoming and Outgoing.
What is the best way to handle this? I really was hoping their is a 3rd party site that handles outgoing and incoming email for multiple top level domains under one company name but am unsure.
There is always the option of doing our own SMTP/POP service, but we would really like to steer away from the responsibilities of email.
Thanks everyone,
~kvq
Can't they just setup an A record or a CNAME to point to your servers?
If they did an A record it would allow just webapp.theirdomain.com to go to your severs and everything else can just stay on their DNS.
The other option and maybe a better option is for them to setup a CNAME. Then you can just setup companyA.yourdomain.com and then they can just setup a CNAME that points webapp.theirdomain.com to companyA.yourdomain.com
You really do not want to be responsible for all of their DNS. They can keep their DNS where ever they want and keep their MX records the way they are.
I hope this helps

Redirect to a web server depending on location with nginx

Im working on a web site that has to be reachable from many countries under the same domain.
Id like to know how can I receive a request with nginx (or any other static file server), and send it to different web servers depending on IP's location.
I mean, what is the point on having multiple db machines on country A and B, if the server that serves you the page is chosen by round robin.
Maybe theres another solution to my problem, and I would be very happy if someone can explain it to me.
It sounds like you are looking for a geographic page re-director.
This company provides a solution that will do the trick: www.geobytes.com
The idea is that your web server will redirect visitors to a location specific HTML page. So that, a guy in India that visits www.example.com will be shown a page customized for India, while a visitor from say Canada will see the Canadian home page.
It looks like they have PHP(http://forums.geobytes.com/viewtopic.php?f=9&t=6815) and Javascript APIs.
Some of their products are free, like the geographic page re-director(http://www.geobytes.com/GeoDirection.htm)
Hope it helps.
As stackoverflow is for programming issues, You’ll probably get a better response at https://serverfault.com/, which is geared toward “Networking, servers, or maintaining other people's PCs”. (See the FAQ.)