Support

Admin Tools

#24642 [Feature request] Enable Cross-Origin Resource Sharing (CORS) for specific domain(s)

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by menolo on Wednesday, 09 March 2016 05:51 CST

menolo
For some sites I had to enable CORS only for one or more specific domains. Without enabling this for all domains.

It would be great if it was possible to Enable Cross-Origin Resource Sharing (CORS) for specific domains.

For now I'm using something like this as a rule at the bottom of the htaccess file (through the Admin Tools htaccess maker).


# Sets CORS headers for request from example1.com and example2.com pages
# for both SSL and non-SSL
SetEnvIf Origin "^https?://[^/]*(example1|example2)\.com$" ORIGIN=$0
Header set Access-Control-Allow-Origin %{ORIGIN}e env=ORIGIN
Header set Access-Control-Allow-Credentials "true" env=ORIGIN
# Always set Vary: Origin when it's possible you may send CORS headers
Header merge Vary Origin

Source: https://gist.github.com/brianlmoon/2291111c5c69252c85f4
(There might be better options)

nicholas
Akeeba Staff
Manager
If you know you need to enable CORS for specific domains then you should also know how to write your own .htaccess directives to do that, or even enable CORS only for specific resources. Adding this kind of feature to Admin Tools would confuse the bulk of our clients and not cater for all use cases anyway.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

menolo
Thanks Nicholas. I agree.

Just for reference for others with the same question a pretty good answer on stackoverflow: http://stackoverflow.com/questions/1653308/access-control-allow-origin-multiple-origin-domains

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!