Configure path redirect on asset canster

Hi, I’m wondering if it is possible to configure redirect logic within an asset canister. What I want to achieve is:

When the User navigates to
Then the asset Canister redirects to

Is it possible to achieve that by canister configuration without adding custom logic to the asset canister?

Thanks for any hints :pray:

I once redirected to /myfile.txt using this as my index.html:

<meta http-equiv="refresh" content="0; URL=/myfile.txt" />

1 Like

As far as I’m aware, dfx asset canister currently does not support server side functionalities like redirects or rewrites; these features are likely on the IC only supported by Juno at the moment.

@NathanosDev is developing a Rust crate aimed at integrating those kind of features easily in any certified asset canister. Should the asset canister adopt this crate in the future, it’s likely it will supports those as well.


The plan is definitely to have the asset canister adopt the library, but I can’t say what features the asset canister will choose to expose to end users.

In any case, the goal is to make it super simple for developers to make custom asset canisters and have flexibility to define their own routing logic so any advanced cases not supported by the asset canister can be acheived easily by directly using the library.

Cool, I think that could solve it for me. Will give it a try :pray: