Explorar o código

added cors to GetFeature

Piotr Labudda %!s(int64=8) %!d(string=hai) anos
pai
achega
d4d688fe8e
Modificáronse 2 ficheiros con 5 adicións e 1 borrados
  1. 4 0
      SE/se-lib/Api.php
  2. 1 1
      SE/static/p5WFS/GetFeature.js

+ 4 - 0
SE/se-lib/Api.php

@@ -15,6 +15,10 @@ class Api {
 	}
 
 	public function execute($url) {
+		header('Access-Control-Allow-Credentials: true');
+		header('Access-Control-Allow-Origin: https://dev.procesy5.pl');
+		// header('Access-Control-Allow-Origin: *');
+		// header('Access-Control-Max-Age: 86400'); // cache for 1 day
 		$request = $this->parseUrl($url);
 
 		$apiRouterName = $request->apiRouterName;

+ 1 - 1
SE/static/p5WFS/GetFeature.js

@@ -129,7 +129,7 @@ function p5WFS_GetFeature(typeName, query) { // @returns Promise
 
 	return window.fetch(link, Object.assign({
 		method: method,
-		credentials: 'same-origin',
+		credentials: 'include',
 	}, ('POST' === method)
 		? {
 			body: postData