The product team has stated that this is by design. If a URL fragment is the first call on the app that is not yet authenticated, the URL fragment will be lost. So the workarounds are change the app, so that either it authenticates first with the base app before making these calls using javascript, or to change the app to append the URL fragment to the redirect once the redirects are done.
Azure Application Proxy -- Relaystate URI getting truncated because of special character "#" during Pre-Auth

Mukesh Kumar
1
Reputation point
Hi team,
While accessing the direct application URL, which is part of the automated application mail, if that URL access is with Pre Authentication , URI relay state is truncated because of special character "#" within the URI. However, when same URL is accessed without Pre-Authentication, it works fine.