Icx-proxy wget calls?

I’m doing a test of my http file server running dfx local and icx-proxy

running icx-proxy like this: icx-proxy --address 127.0.0.1:8453 -vv

I uploaded by my file to the bucket, and now I want to view it.

I’m able to view it on a browser with a URL like this:
http://qjdve-lqaaa-aaaaa-aaaeq-cai.localhost:8453/storage?fileId=testfile.txt231&chunkNum=1
The browser is able to interpret the suffix as something meaningful.

However if I use cURL with the same command I get the error
curl: (6) Could not resolve host: qjdve-lqaaa-aaaaa-aaaeq-cai.localhost

Is there an alternative way to specify the canister ID that I want to forward the request to, that cURL or wget could understand? Thanks!

1 Like

Are you using Chrome and/or MacOS?

I believe Chrome resolves *.localhost to 127.0.0.1 no matter what DNS says, but most programs don’t do that. It should help to edit your /etc/hosts file to achieve that (assume MacOS has that - I’m a Unix guy)

1 Like

Try passing the canister id as a query parameter, for example:

$ curl -o testfile.txt 'http://localhost:8453/storage?fileId=testfile.txt231&chunkNum=1&canisterId=qjdve-lqaaa-aaaaa-aaaeq-cai'

This works with the shipped asset canister, for example

$ curl 'http://localhost:8000/sample-asset.txt?canisterId=ryjl3-tyaaa-aaaaa-aaaba-cai'

This is a sample asset!
1 Like

Thanks for the solution, my tests are passing!

2 Likes