I have this code in my MVC Controller:
[HttpGet]
[OutputCache(VaryByParam = "*", Duration = 3600, Location = System.Web.UI.OutputCacheLocation.ServerAndClient)]
public async Task<string> GetAPI(string callback, string libraries)
{
var location_selector_script = System.IO.File.ReadAllText(Server.MapPath("~/Scripts/nav/locselector.js"));
var res = await Utilities.API.GetAsync("https://maps.googleapis.com/maps/api/js?key=" + ConfigurationsHelper.GoogleMapsAPIKey
+ "&callback=" + callback + "&libraries=" + libraries);
return res + location_selector_script;
}
and call it like this:
<script async defer src="/Navigation/GetAPI?callback=initMap&libraries=places"></script>
Is this a good idea to initialize Google APIs in backend?
HttpClientHandler
with a differentWebProxy
to theHttpClient
then use it. This would make the request uses a different proxy than the pre-configured one, which hides the traffic from the current connection for basic tracing tools such as browsers andFiddler
or similar tools. \$\endgroup\$ – iSR5 Nov 7 '20 at 9:29