diff --git a/portable_fdsnws_dataselect/handler.py b/portable_fdsnws_dataselect/handler.py index 5757f0e..3f41cf5 100644 --- a/portable_fdsnws_dataselect/handler.py +++ b/portable_fdsnws_dataselect/handler.py @@ -85,6 +85,7 @@ def return_error(self, code, err_msg): datetime.datetime.now().isoformat(), version[0], version[1], version[2]) self.send_response(code) self.send_header('Content-type', 'text/plain') + self.send_header('Access-Control-Allow-Origin', '*') self.send_header('Connection', 'close') self.end_headers() self.wfile.write(msg.encode("utf8")) @@ -96,6 +97,7 @@ def return_version(self): """ self.send_response(200) self.send_header('Content-type', 'text/plain') + self.send_header('Access-Control-Allow-Origin', '*') self.end_headers() message = "%d.%d.%d\n" % version self.wfile.write(message.encode("utf8")) @@ -106,6 +108,7 @@ def return_wadl(self): """ self.send_response(200) self.send_header('Content-type', 'application/xml') + self.send_header('Access-Control-Allow-Origin', '*') self.end_headers() server_port = "" if self.server.server_port != 80: @@ -173,6 +176,7 @@ def common_process(self, request): self.send_response(200) self.send_header('Content-Type', 'text/plain') + self.send_header('Access-Control-Allow-Origin', '*') self.end_headers() summary = "#{0:<7s}{1:<8s}{2:<8s}{3:<8s}{4:<28s}{5:<28s}{6:<20s}\n".format( @@ -235,6 +239,7 @@ def common_process(self, request): # If this is the first segment to be written, add the response headers first if total_bytes == 0: self.send_response(200) + self.send_header('Access-Control-Allow-Origin', '*') self.send_header('Content-Type', 'application/vnd.fdsn.mseed') self.send_header('Content-Disposition', 'attachment; filename=fdsnws-dataselect_%s.mseed' % request_time_str)