Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

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

Open
ninegua opened this issue Oct 9, 2022 · 3 comments
Open

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

ninegua opened this issue Oct 9, 2022 · 3 comments

Comments

@ninegua
Copy link
Member

ninegua commented Oct 9, 2022

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

icx-proxy/src/proxy/mod.rs

Lines 157 to 158 in 4f73294

.route("/api", forward_to_replica_service.clone())
.route("/api/*path", forward_to_replica_service)

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?

@Daniel-Bloom-dfinity
Copy link
Contributor

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

@zire
Copy link

zire commented Oct 11, 2022

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

@ilbertt
Copy link

ilbertt commented Apr 16, 2023

@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:

icx-proxy/src/proxy/mod.rs

Lines 133 to 134 in 4f73294

let router = if let Some(proxy_url) = opts.proxy {
info!("Setting up `/_/` proxy to `{proxy_url}`");

What am I missing?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants