Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: f590a0e5da
...
compare: e8a66914b6
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 12 additions and 0 deletions.
  1. +6 −0 Config/bootstrap.php
  2. +6 −0 Controller/SearchController.php
View
6 Config/bootstrap.php
@@ -67,3 +67,9 @@
Configure::write('ElasticSearch', array(
'url' => 'http://localhost:9200/documentation/'
));
+
+Configure::write('AccessControlAllowOrigin', array(
+ 'http://cakephp.org',
+ 'http://book.cakephp.org',
+ 'http://stage.book.cakephp.org',
+));
View
6 Controller/SearchController.php
@@ -7,6 +7,12 @@ class SearchController extends AppController {
* Search the elastic search index.
*/
public function search() {
+ foreach (Configure::read('AccessControlAllowOrigin') as $domain) {
+ if (strpos($this->request->referer(), $domain) === 0) {
+ $this->response->header(array('Access-Control-Allow-Origin', $domain));
+ break;
+ }
+ }
if (empty($this->request->query['lang'])) {
throw new BadRequestException();
}

No commit comments for this range

Something went wrong with that request. Please try again.