Openlayers 4 - Load WMS image layer require authentication
问题 I try to load WMS image layer with openlayers 4.6 and angular 5, the code is: const syr_layer = new ol_layer_Image({ source: new ol_source_ImageWMS({ url: 'serverurl', crossOrigin: 'anonymous', serverType: 'geoserver', params: { 'LAYERS': 'tst:syr'}, projection: 'EPSG:4326' }); }); But it throws an error: GET (myserverurl) 401 (An Authentication object was not found in the SecurityContext) How can I send authentication header with the GET request sent by openlayers? 回答1: For you purpose, you