HOST vs APP_URL vs SHOPIFY_APP_URL in Shopify embedded apps

Can you explain how these 3 env variables work?

https://shopify.dev/docs/apps/build/cli-for-apps/app-structure

As I understand, I should set SHOPIFY_APP_URLwhen I deploy the app to Shopify.What about HOST and APP_URL. Are they served automatically?
I see it working in local dev and not in the deployed.