Hie all,

I'm developing a bulk sms website, there are users and resellers for the site. I want to map my to another ip through A record. Problem is how to identify the ip user / reseller ?

Please help me.

Dani AI

Generated

Short practical summary and a reliable approach.

The key design decision is whether the central application should receive the HTTP requests or the reseller's server should. Pointing an A record at a reseller's hosting IP sends traffic to that reseller's machine — the central app will not see those requests. For a centralized service that wants to identify a reseller automatically, have resellers point their hostnames to the central service (CNAME to a canonical host when possible, or an A to the central IP for apex domains) and then use the HTTP Host header / SNI to map host -> reseller record in the database. As pointed out, identifying by client/server IP alone is brittle (shared hosts, NAT, CDNs, dynamic addresses).

Practical server-side workflow (recommended)

  • Accept requests for many hostnames (wildcard or catch-all virtual host).
  • In application code, lookup reseller by Host header; if not found, optionally fall back to a server-IP match.
  • Use strong authentication for server-to-server calls (API keys + HMAC or mutual TLS) rather than IP-only checks.
  • Keep a management UI / API so resellers can update allowed IPs/domains and view last-seen IPs.

Example fallback lookup (illustrative PHP):

$host = strtolower($_SERVER['HTTP_HOST'] ?? '');
$reseller = db_get_one('SELECT * FROM resellers WHERE domain = ? LIMIT 1', [$host]);

if (!$reseller) {
  $ip = explode(',', ($_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR']))[0];
  $reseller = db_get_one('SELECT * FROM resellers WHERE server_ip = ? LIMIT 1', [$ip]);
}
if (!$reseller) { header('HTTP/1.1 403 Forbidden'); exit; }

Important operational notes and pitfalls

  • If resellers use Cloudflare or other CDNs the visible REMOTE_ADDR will be the CDN; require X-Forwarded-For and trust only known proxies.
  • SSL: custom domains need certificates. Wildcard certs work for subdomains of the main domain; custom domains require per-domain certs (ACME automation recommended).
  • If the reseller must host the site on their IP, require that server to call the central API (webhook) with an API key or client cert so the central DB can still verify identity.

This approach keeps DNS simple, avoids brittle IP-matching, and provides secure server-to-server verification while supporting both central-hosted and reseller-hosted scenarios.

Recommended Answers

All 2 Replies

Don't think I quite understand, or, if I do, why would you want to do such a thing..

Ok, have a form that asks the user if (s)he is a user or a re-seller. Then, create a database that stores this information. Everytime you want to check, you can check to see if the IP address matches the re-sellers/users IP stored within the database. What if the user's IP address changes? What if they access a different computer? Is this therefore a really efficent way to identifying someone?

Dear phorce, Thanks for your reply.

Here we are talking about Hosting ip address ( You will find on Control panel ). I want to add a reseller using his / her server ip address. Then i will add "A Record" to that ip address using Simple DNS Editor so that the website / sub-domain will map to our domain. Now i want to check the db from that ip address.

Thanks in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.