A
A
APXAT2016-05-15 18:15:53
Domain Name System
APXAT, 2016-05-15 18:15:53

How to redirect all HTTP requests and add information to them?

Given: There are several wi-fi routers. Clients connect to them.
Required: Redirect any http request to www.example.com/{router_identifier}. Or add a header or cookies to the request with the router ID. In general, you need to make it clear to the script on example.com which router the client making the request is connected to.
I found a simple solution for redirection: raise a DNS server on the hosting, which will give the IP of my www.example.com to any DNS request, but I don’t understand how to add the required path or header to the client’s http request.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lexxtor, 2016-05-15
@Lexxtor

In my opinion, with such a redirect through DNS it is impossible to do what you want.
As I understand it, you will have to upload your firmware to routers so that they act according to this algorithm:
no GET routerID parameter?
then a redirect to: request + "?routerID=123"
A redirect in HTTP is done by returning a 302 code (for example) and adding a
location header: example.com?routerID=123

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question