Please show localhost subdomain canister ids after dfx deploy

Right now after a dfx deploy canister ids are shown like this:

Deployed canisters.
URLs:
  Backend canister via Candid interface:
    dfinity_js_backend: http://127.0.0.1:4943/?canisterId=bd3sg-teaaa-aaaaa-qaaba-cai&id=bkyz2-fmaaa-aaaaa-qaaaq-cai
    ledger_canister: http://127.0.0.1:4943/?canisterId=bd3sg-teaaa-aaaaa-qaaba-cai&id=ryjl3-tyaaa-aaaaa-aaaba-cai

I ask that we also display the HTTP endpoints for use with curl, fetch, postman, the browser, etc which should really be http://canisterId.localhost:port.

I never recommend that anyone use the URL form listed above, why is it recommended? Using localhost subdomains works very well in I believe all situations I’ve encountered, whereas the form shown above does not. There’s an old forum post where this was a real problem when using non-bundled JavaScript or other fetching of assets as the canisterId was somehow lost along the way.

Anyway, as Demergent Labs tries to move people towards a REST-based paradigm, as I think is good for the entire IC, it would be great to show proper URLs. It’s confusing to people to not have them when working with Azle.

In that case you’ve never tried to use Safari. It simply does not recognize e.g. bd3sg-teaaa-aaaaa-qaaba-cai.localhost as a localhost address.

Deployed canisters.
URLs:
  Backend canister via Candid interface:
    dfinity_js_backend:
      - http://127.0.0.1:4943/?canisterId=bd3sg-teaaa-aaaaa-qaaba-cai&id=bkyz2-fmaaa-aaaaa-qaaaq-cai
      - http://bd3sg-teaaa-aaaaa-qaaba-cai.localhost:4943/?id=bkyz2-fmaaa-aaaaa-qaaaq-cai
    ledger_canister:
      - http://127.0.0.1:4943/?canisterId=bd3sg-teaaa-aaaaa-qaaba-cai&id=ryjl3-tyaaa-aaaaa-aaaba-cai
      - http://bd3sg-teaaa-aaaaa-qaaba-cai.localhost:4943/?id=bkyz2-fmaaa-aaaaa-qaaaq-cai

WDYT about this? Does this become too cluttered? Or do you have any better suggestions? We don’t really want to leave Safari users without any usable URL

1 Like

@Severin: A solution that would work on all browsers is to switch to port based routing:

1 Like

Ah…Safari really doesn’t support localhost subdomains? That is sad. Yes I like the proposal you have here.