- Plesk for Linux
How to set up cross-origin resource sharing (CORS) in Plesk to display content from example1.com on example.com?
Note: CORS is supported in the following browsers: Chrome 3+, Firefox 3.5+, Opera 12+, Safari 4+, Internet Explorer 8+
1. Log into Plesk UI on the source server, where domain example1.com is hosted.
2. Navigate to the tab Domains > example1.com > Apache and nginx settings and add the following directives to the section Additional directives for HTTP and to the section Additional directives for HTTPS:
CONFIG_TEXT: Header set Access-Control-Allow-Origin "example.com"
file with the following content can be used instead of Additional directives:
CONFIG_TEXT: <IfModule mod_headers.c>p
Header always set Access-Control-Allow-Origin "example.com"
4. If Nginx is enabled and static content needs to be displayed, add the following directive to Domains > example1.com > Apache and nginx settings > Additional nginx directives and remove Apache directives added on step #2:
CONFIG_TEXT: add_header Access-Control-Allow-Origin "example.com";
- Enable CORS website.