Fix 500 error

Apply fix given thanks Landry:

first issue : the Location header seems sometimes removed, or sometimes doubled. It's removed for example when i try to fetch a file from geonetwork :
second issue: even when bypassing the sec-proxy (ie using the http://localhost:8080/geoserver/ url, with local admin creds), it seems some requests (only the POST and PUT ?) are happening twice, and this seems to produce weird behaviour when using the geopublish feature from geonetwork.