Skip to content

Commit 7329fd6

Browse files
authored
Merge pull request #2 from vlobzakov/master
CORS instruction updated
2 parents 86beeb4 + 1a97bca commit 7329fd6

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

CORS-CDN/README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33
Installing the **Edgeport - Premium CDN Add-On** on Magento 2 application, you will be experiencing [**Cross-Origin Resource Sharing (CORS)**](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) issue which is invoked when a web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, and port) than its own origin.
44

55
There are several ways how to overcome this issue. One of them we describe here.
6+
Open [Jelastic Configuration Manager](https://docs.jelastic.com/configuration-file-manager) and do the following steps:
67

7-
1. Upload **cors.conf** file from repository directory **CORS-CDN** to **/etc/nginx/** directory.
8+
1. Create new **/etc/nginx/conf.d/cors** directory.
9+
10+
2. Upload **cors.conf** file from repository directory **CORS-CDN** to **/etc/nginx/conf.d/cors** directory.
811

9-
2. Open **cors.conf** , find line #5 and replace **magentohostname** with your environment hostname and **magentocdnhostname** with magento CDN hostname obtained upon Add-On installation.
12+
3. Open **cors.conf** , find line #5 and replace **magentohostname** with your environment hostname and **magentocdnhostname** with magento CDN hostname obtained upon Add-On installation.
1013

1114
For example: **if ($http_origin ~* 'https?://(localhost|magento\\.jelastic\\.com|magento\\.cdn\\.edgeport\\.net)')**
1215

13-
3. Replace **/etc/nginx/conf.d/site-default.conf** with **site-default.conf** from repository directory **CORS-CDN**.
16+
4. Replace **/etc/nginx/conf.d/site-default.conf** with **site-default.conf** from repository directory **CORS-CDN**.
1417

15-
4. The changes added as lines **67, 79** and **104** to **site-default.conf**.
18+
5. The changes added as lines **67, 79, 104** and **113** to **site-default.conf**.
19+
20+
6. Change the URLs in magento admin panel like as on the example picture below.
21+
22+
<p align="left">
23+
<img src="../images/urls-example.png" width="600">
24+
</p>

CORS-CDN/cors.conf

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
set $cors 'true';
2-
31
#### Replace "magentohostname" with Jelastic platform hostname or customdomain and "magentocdnhostname" with magento CDN hostname obtained from add-on or CDN custom domain you've bound to the environment.
42
#### For example: if ($http_origin ~* 'https?://(localhost|magento\.jelastic\.com|magento\.cdn\.edgeport\.net)') {
53
if ($http_origin ~* 'https?://(localhost|magentohostname|magentocdnhostname)') {

CORS-CDN/site-default.conf

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ location /media/ {
110110

111111
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
112112
add_header Cache-Control "public";
113+
add_header Access-Control-Allow-Origin "*";
113114
add_header X-Frame-Options "SAMEORIGIN";
114115
expires +1y;
115116
try_files $uri $uri/ /get.php?$args;

images/urls-example.png

164 KB
Loading

0 commit comments

Comments
 (0)