Modifying NGINX Server Configuration of Canister

I’m currently using one canister to retrieve assets from another canister at runtime. But I’m running into an issue with CORS. See this for definition of CORS: https://web.dev/cross-origin-resource-sharing/

It looks like canisters use nginx as their web server. Basically, I need to modify the nginx server headers of the asset canister to allow the first canister to retrieve its assets. I created my project using ‘dfx new’ but I can’t seem to find a nginx.conf configuration file in the project. Is there a way to modify the server configuration of the web server that is running on canisters?

This should be addressed soon, otherwise Dapps such as 3D games that need to download assets at runtime will not be able to rely on multiple canisters to host assets.

My understanding is that the HTTP headers are under full control of your canister, so should be able to fix that.

If you are using the standard asset canister, you may have to fork and fix it. It’s code is in https://github.com/dfinity/certified-assets and the headers are set in these lines:

1 Like

Thanks for the response! Appreciate it. I’ve never used Rust before so I’m having trouble figuring out how this certified-assets canister works. Is there a folder that I can add assets to similar to the “assets” folder in a “dfx new” project? And can I retrieve the assets using the canister url? eg. rno2w-sqaaa-aaaaa-aaacq-cai.ic0.app/logo.png