@@ -26,6 +26,36 @@ This configuration limits memory usage to 512mb. This should be enough for most
2626- " ES_JAVA_OPTS=-Xms512m -Xmx512m" ` environment variable in ` docker-compose.elasticsearch.yaml`
2727` ` `
2828
29+ ## CORS settings
30+
31+ To better support decoupled architecture testing, HTTP.CORS configuration to expose the server to any origin is in place.
32+
33+ ` ` ` yaml
34+ - " http.cors.allow-origin=*"
35+ - " http.cors.enabled=true"
36+ - " http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization,Access-Control-Allow-Origin,Access-Control-Request-Headers"
37+ - " http.cors.allow-credentials=true"
38+ - " http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE"
39+ ` ` `
40+
41+ When paired with a frontend request with the proper headers, this should allow for cross-origin requests.
42+
43+ ` ` ` script
44+ // Example JS fetch() with headers
45+ fetch('http://vca.ddev.site:9200/elasticsearch_index_db/_search', {
46+ method : ' post' ,
47+ body : querystring,
48+ //headers : { 'Content-Type': 'application/json' },
49+ headers : {
50+ ' Origin ' : ' http://localhost:8000' ,
51+ ' Content-Type ' : ' application/json' ,
52+ ' Access-Control-Allow-Origin ' : ' *' ,
53+ ' Access-Control-Request-Headers ' : ' access-control-allow-origin,content-type' ,
54+ },
55+ })
56+ ```
57+
58+
2959If you change this variable, make sure to remove the ` #ddev-generated ` line at the top of the file.
3060
3161You can use ` ddev logs -s elasticsearch ` to investigate what the elasticsearch daemon has been up to, or if you have a RAM-related crash.
0 commit comments