Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added domain flexibility to Access-Control-Allow-Origin header

  • Loading branch information...
commit 2688d06830f79ba66522618120efa77beae7d49f 1 parent f590a0e
Graham Weldon authored March 05, 2012

Showing 1 changed file with 6 additions and 0 deletions. Show diff stats Hide diff stats

  1. 6  Controller/SearchController.php
6  Controller/SearchController.php
@@ -7,6 +7,12 @@ class SearchController extends AppController {
7 7
  * Search the elastic search index.
8 8
  */
9 9
 	public function search() {
  10
+		foreach (Configure::read('AccessControlAllowOrigin') as $domain) {
  11
+			if (strpos($this->request->referer(), $domain) === 0) {
  12
+				$this->response->header(array('Access-Control-Allow-Origin', $domain));
  13
+				break;
  14
+			}
  15
+		}
10 16
 		if (empty($this->request->query['lang'])) {
11 17
 			throw new BadRequestException();
12 18
 		}

0 notes on commit 2688d06

Please sign in to comment.
Something went wrong with that request. Please try again.