icx-proxy icon indicating copy to clipboard operation
icx-proxy copied to clipboard

400 error for assets with path /api/...

Open ninegua opened this issue 2 years ago • 3 comments

If some asset is uploaded to the asset canister under name api/xyz, then requesting it through icx-proxy will result in 400 error, which happens on both local dfx deployment and main net.

This is because icx-proxy hard coded path api to redirect to replica in these lines https://github.com/dfinity/icx-proxy/blob/4f732947846f3314e73db185e2932ad5a05c37b3/src/proxy/mod.rs#L157-L158

Given that /api is such a common prefix, shall we change it to something like /_/api ? Or at least give a better error message with some description of what could be going on?

ninegua avatar Oct 09 '22 09:10 ninegua

We will be deprecating and removing all these routes since the --proxy flag is now unused.

Daniel-Bloom-dfinity avatar Oct 11 '22 01:10 Daniel-Bloom-dfinity

Thanks Paul for identifying this issue for me. I had to change my api path from api/posts to api-ic/posts to avoid this awkward and very unexpected error. I thought it was something wrong with Svelte and it turned out to be good old IC ...

https://hbc6w-gqaaa-aaaag-aagdq-cai.raw.ic0.app/api-ic/posts

zire avatar Oct 11 '22 04:10 zire

@Daniel-Bloom-dfinity when you said:

the --proxy flag is now unused.

what did you mean? Because I can still use the --proxy argument, and I get the log:

INFO icx-proxy: icx_proxy::proxy: Setting up `/_/` proxy to `<my-proxy-address>` version="0.10.1"

and I also see it's still handled in the code: https://github.com/dfinity/icx-proxy/blob/4f732947846f3314e73db185e2932ad5a05c37b3/src/proxy/mod.rs#L133-L134

What am I missing?

ilbertt avatar Apr 16 '23 16:04 ilbertt