How can I set an alias dynamically based on request?
As far as I know, using the @web alias is discouraged if its determined automatically (which is the default behavior).
If you override it with a hardcoded value in production I think you should be fine.

Edit
After checking the documentation, the warning is now pretty dissuasive against using the @web alias :

When you actually use it in a site's base URL setting in the control panel, the warning is a little more moderated:

I'm not sure if its because the documentation is more up to date or if it's actually fine to use it when overridden.