golemcloud / golem

Golem: Transparent durable execution for any programming language

Home Page:https://learn.golem.cloud/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make sure subdomain works with localhost in API Gateway

afsalthaj opened this issue · comments

We have a user currently facing an issue due to the fact, we don't support subdomain for localhost

As the aforementioned user, solving this isn't a big deal for me. I mentioned this in discord here:

https://discord.com/channels/1134448700572319785/1134448701260169249/1234981436172537967

A bit more context -- I have my app setup with two APIs, segregated because they [will] have very different security policies. 'traderapi' and 'adminapi'. Then I also am setting things up with 'environments' so that I can deploy 'test', 'staging', 'production', etc but also so I can run an integration test script with a randomly-generated environment. So the APIs should be hosted at something like environment.traderapi.host

I have an integration script that should ideally work both locally and in CI, which starts up the golem cloud docker, deploys my app with a randomly generated environment, and then calls the API endpoints to run tests. I initially thought I could do environment.traderapi.localhost because it seemed that environment.traderapi.localhost was resolving to localhost without any special local configuration, so it would work nicely. However, it turned out that this mapping from *.localhost -> localhost is a peculiarity to curl. curl http://environment.traderapi.localhost/ works to localhost, but ping environment.traderapi.localhost doesn't.

So far I have come up with a workaround where I am running dnsmasq locally to map *.dev to localhost, and I am deploying to environment.traderapi.dev -- however I haven't figured out yet how to make that work with running the integration test script in CI.

I suppose if we did support subdomains on localhost host in golem, then I could do my integration tests with curl, but that seems kind of ugly, because this *.localhost -> localhost mapping is just a 'feature' of curl it turns out, which isn't something that feels right to rely on.

Thanks Sameer for the detailed response to the ticket, and we are closing this. As you can see with #460, we are making subdomains optional and moving this ticket to closed