I’m wondering if it would be possible to transparently point to a gateway instead of a real website by intercepting DNS? For example if the browser makes a request to a DNSLink website like ipfs.io, something like NSS (name service switch) calls a program, right before calling regular DNS, which checks whether the website has a dnslink record, and if so, it returns 127.0.0.1 or whatever the gateway address is. Has something like this already been done?
While technically possible, not useful for websites that have TLS/HSTS set up.
You can use Gateway port as HTTP proxy to ensure IPFS node is doing DNS lookups, and not your browser, and tweak your DNS to point at gateway of your choice. Pages will load over
http:// but the problem is TLS and HSTS: if you visited the website before, your browser has HSTS cached, and will return an error.