Last active
November 11, 2021 13:51
-
-
Save rpayanm/edbcf41e3d641dbba718cacc028177b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allow other domain do Rest request to drupal site: | |
- Use `services.yml`: | |
``` | |
cors.config: | |
enabled: true | |
# Specify allowed headers, like 'x-allowed-header'. | |
allowedHeaders: ['*'] # All header | |
# Specify allowed request methods, specify ['*'] to allow all possible ones. | |
allowedMethods: ['GET'] # Methods | |
# Configure requests allowed from specific origins. | |
allowedOrigins: ['http://livgmayo.local', 'https://dev.livgenerationsahwatukee.com'] # Allow origins You MUST NOT include '/' at the end. | |
# Sets the Access-Control-Expose-Headers header. | |
exposedHeaders: false # Same | |
# Sets the Access-Control-Max-Age header. | |
maxAge: false # Same | |
# Sets the Access-Control-Allow-Credentials header. | |
supportsCredentials: false # Same | |
``` | |
- Include it in settings.php: | |
`$settings['container_yamls'][] = $app_root . '/sites/services.yml';` | |
- Clear cache every time you edit this file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment