1

I love decentralized domain projects. I have worked with Unstoppable Domains, ENS domains, Handshake domains, and even just simple IPNS domains and IPFS hashes. The domain name system used by web2.0 is a central point of failure for a lot of decentralized dapps. I'm trying to build a dapp that is a simple react frontend connected to a simple Akash express.js server backend. The code for the project is here https://github.com/ChristianOConnor/spheron-react-api-stack. When I deploy my react frontend to an traditional static hosting platform I get a web2.0 domain. This makes it simple for me to set a cors policy in my Akash backend. I simply set my server.js cors policy to only allow calls from the frontend's domain.

app.use(
  cors({ origin: process.env.ORIGIN, preflightContinue: true, credentials: process.env.CREDENTIALS })
);

"process.env.ORIGIN" is the frontend's domain. But... how would I do cors if I ran the frontend on a decentralized domain? Let's take ENS for example. To go to an ENS domain in Chrome you must put something like this in your url bar "DOMAIN_NAME_HERE.eth.limo." Notice the ".limo" to indicate that you're using the ETH.LIMO gateway to view the domain. If you want to view an ens domain without a gateway, I think you need a special browser extension.

There are 2 parts of basic domains: the 2LD and TLD. Take google.com for example, "google" is the 2LD and ".com" is the TLD. Some domains like google.uk.co have a 3LD "google," 2LD "uk," and TLD ".co." When using cors I think you are required to give the 2LD and the TLD. The problem is that any cors policy requires a TLD and neither IPFS, nor any of the decentralized domain services expose a TLD in a decentralized way. They all require gateways that have their own centralized TLDs. So how can I ensure that only certain IPFS hashes or decentralized domains like an ENS domain can make requests to my API? Is there an IPFS, ENS, Handshake, or Unstoppable Domain version of cors?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.