So we've a global javascript but that script has certain URL's specific to environments. What's the best practice to have different URL's configured based on environment.
I would suggest to configure the URLs in run mode specific OSGI configuration nodes. And then you can read those variables in the page head.jsp and render them as global variables inside the <script> tag. The JS file can simply use these variables to fetch the URLs value.