i currently have azure web app static free tier and it need to load gz & json file from index.html, however when i checked the site through browser console network the file took long time to response i had test in local it work and just wondering whether i need to do something with the staticwebapp.config.json due at first i thought it cause by path target to the file but it seems not that the cause gz data load json file load
this is the code which only in html & ajax for call the gz file
// Fetch the compressed GeoJSON data from new_data.gz
$.ajax({
// url: '/special-reports/ground-truths/map/new_data.gz',
url: 'new_data.gz',
method: 'GET',
headers: { 'Content-Encoding': 'gzip' },
xhrFields: {
responseType: 'arraybuffer' // Set response type to handle binary data
},
success: function (compressedData) {
try {
// Log the raw data received for debugging
console.log("Compressed data received:", compressedData);
// Decompress the data using pako.ungzip
var decompressedData = pako.ungzip(new Uint8Array(compressedData), { to: 'string' });
// Parse the decompressed data as JSON
var geojson = JSON.parse(decompressedData);
console.log("GeoJSON data loaded successfully.");
// Process the GeoJSON data
processGeojsonData(geojson);
} catch (error) {
// Log error details if decompression or parsing fails
console.error("An error occurred while processing the GeoJSON data:", error);
}
}
});
below also the structure of the files structure files directory and content of staticwebapp.config.json
{
"routes": [
{
"route": "/special-reports/ground-truths/map",
"serve": "/special-reports/ground-truths/map/index_test.html",
"statusCode": 200
}
],
"mimeTypes": {
".json": "text/json",
".gz": "text/gzip"
}
}
thank you
I am able to load files larger than 20 MB.