I have a number of redirects in my DNS records. I understand how to program through the API the A records and the CNAME records which redirect to a different web address. I will ignore the MX records as you handle that and TXT records aren't necessary but I like that I could change an A record when the IP of the host changes through the API. Well done.
My issue is with full URLs, such as redirecting to a google drive or a GET query address. My understanding as those type of forwards require an Apache-PHP server and I did read your article on that here: https://docs.opalstack.com/topic-guides/redirects/ but my rewrite rules would be far more complicated than just redirecting all traffic to one server. I would need to change the regex for every subdomain and have multiple ReWrite Rules for each subdomain.
I have a csv with all the complex routing information and would like to create an API script to program it but it seems it would just be writing rewrite rules on the server running Apache. My question is then, what is included in the search for the rewrite rule? Because it looks like the rewrite rule is only looking at the file/directory following the IP, and not the subdomain you wanted to redirect. I understand that a Site would be created to handle the subdomain, though I could put the CNAME record to redirect directly to https://drive.google.com/drive/u/0/folders/<Folder ID>, because it seems this is beyond the scope of a rewrite rule. My CSV has the following fields:
- fqdn (Fully Qualified Domain Name), e.g. "domain.com"
- host, (including subnet), e.g. "drive.domain.com"
- host_ulabel (Typically the same as host with invalid characters transformed)
- type (how often refresh), e.g. http301, http302, or cloak
- url (where to send traffic, full url), e.g. https://drive.google.com/drive/u/0/folders/<Folder ID>
- protocol (Typically HTTP and HTTPS)
- created_at (A date, could be None)
- updated_at (A date, could be None)
- fqdn_ulabel (Typically the same as fqdn with invalid characters transformed)
Basically, I need to be able to set, on the fqdn domain, the host, the type, and the URL at least. I don't think rewrite would work for this, and I don't see how a site can be set up in this way. Please help.
Jeffrey