Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Access control header #931

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions extensions/components/com_redcore/admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="enable_access_control_header"
class="btn-group"
type="radio"
default="1"
label="COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_ACCESS_CONTROL_HEADER"
description="COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_ACCESS_CONTROL_HEADER_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset name="REDCORE_OAUTH2_SERVER_OPTIONS"
addfieldpath="/libraries/redcore/form/fields"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_DEBUG="Enable debug"
COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_DEBUG_DESC="If you enable debugging, it will display notifications and warnings in the webservice output."
COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_GZIP_COMPRESSION="Enable Gzip compression feature"
COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_GZIP_COMPRESSION_DESC="Gzip compression will only be available to Clients that request Gzip compression in their headers. It is best to have this option always enabled if the server supports Gzip compression."
COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_ACCESS_CONTROL_HEADER="Enable Access Control Header"
COM_REDCORE_CONFIG_WEBSERVICES_ENABLE_ACCESS_CONTROL_HEADER_DESC="Disabel if you need to remove the Access-Control-Allow-Origin header."

; OAuth2 Server
COM_REDCORE_CONFIG_OAUTH2_SERVER_OPTIONS="OAuth2 Server options"
Expand Down
5 changes: 4 additions & 1 deletion extensions/libraries/redcore/api/hal/document/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ public function render($cache = false, $params = array())

$app->setHeader('Status', $this->hal->statusCode . ' ' . $this->hal->statusText, true);
$app->setHeader('Server', '', true);
$app->setHeader('Access-Control-Allow-Origin', '*', true);
if (RBootstrap::$config->get('enable_access_control_header', '1') == '1')
{
$app->setHeader('Access-Control-Allow-Origin', '*', true);
}
$app->setHeader('Pragma', 'public', true);
$app->setHeader('Expires', '0', true);
$app->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
Expand Down
5 changes: 4 additions & 1 deletion extensions/libraries/redcore/api/soap/document/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ public function render($cache = false, $params = array())
$app->setHeader('Status', $this->soap->statusCode . ' ' . $this->soap->statusText, true);
$app->setHeader('Server', '', true);
$app->setHeader('X-Runtime', $runtime, true);
$app->setHeader('Access-Control-Allow-Origin', '*', true);
if (RBootstrap::$config->get('enable_access_control_header', '1') == '1')
{
$app->setHeader('Access-Control-Allow-Origin', '*', true);
}
$app->setHeader('Pragma', 'public', true);
$app->setHeader('Expires', '0', true);
$app->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
Expand Down