changeset 847:82765aa6de53

Rewrite WMS capabilities documents (content type "application/vnd.ogc.wms_xml") in proxy, too. BTW: Rewrite URLs in XML directives, too.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 28 Sep 2018 12:17:35 +0200
parents 6902032757e4
children 22f7d33eee65
files pkg/controllers/proxy.go
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/proxy.go	Fri Sep 28 11:51:06 2018 +0200
+++ b/pkg/controllers/proxy.go	Fri Sep 28 12:17:35 2018 +0200
@@ -187,6 +187,7 @@
 	"application/xml",
 	"text/xml",
 	"application/gml+xml",
+	"application/vnd.ogc.wms_xml",
 }
 
 func isXML(h http.Header) bool {
@@ -201,7 +202,7 @@
 	return false
 }
 
-var replaceRe = regexp.MustCompile(`\b(https?://[^\s\?]*)`)
+var replaceRe = regexp.MustCompile(`\b(https?://[^\s\?'"]*)`)
 
 func replace(suffix, s string) string {
 
@@ -272,6 +273,9 @@
 		case xml.CharData:
 			tok = xml.CharData(replace(suffix, string(t)))
 
+		case xml.Directive:
+			tok = xml.Directive(replace(suffix, string(t)))
+
 		case xml.EndElement:
 			s := n.lookup(t.Name.Space)