/
Making+cross-origin+HTTP+requests.html
879 lines (524 loc) · 46 KB
/
Making+cross-origin+HTTP+requests.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
<!DOCTYPE html>
<html>
<!-- Mirrored from doc.ez.no/display/DEVELOPER/Making+cross-origin+HTTP+requests by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 31 Jan 2017 08:19:26 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<title>Making cross-origin HTTP requests - Developer - eZ Documentation</title>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=IE7">
<meta charset="UTF-8">
<meta id="confluence-context-path" name="confluence-context-path" content="">
<meta id="confluence-base-url" name="confluence-base-url" content="../../index.html">
<meta id="atlassian-token" name="atlassian-token" content="9996d8127abd36d1b757536de859090f8b455d10">
<meta id="confluence-space-key" name="confluence-space-key" content="DEVELOPER">
<script type="text/javascript">
var contextPath = '';
</script>
<meta name="confluence-request-time" content="1485845135781">
<meta name="ajs-is-space-admin" content=""> <meta name="ajs-has-space-config" content="">
<meta name="ajs-use-keyboard-shortcuts" content="true">
<meta name="ajs-discovered-plugin-features" content="$discoveredList">
<meta name="stp-license-product-name" content="Confluence"/> <meta name="stp-license-days-to-expiry" content="807"/> <meta name="stp-license-is-admin" content="false"/> <meta name="stp-license-should-keep-banner-hidden" content="true"/>
<meta name="ajs-keyboardshortcut-hash" content="206314443b3cf79696d4ad89324a059c">
<meta id="team-calendars-has-jira-link" content="true">
<meta name="ajs-team-calendars-display-time-format" content="displayTimeFormat12">
<meta id="team-calendars-user-timezone" content="UTC">
<script type="text/x-template" id="team-calendars-messages" title="team-calendars-messages"><fieldset class="i18n hidden"><input type="hidden" name="calendar3.month.long.july" value="July"><input type="hidden" name="calendar3.day.short.wednesday" value="Wed"><input type="hidden" name="calendar3.day.short.thursday" value="Thu"><input type="hidden" name="calendar3.month.short.march" value="Mar"><input type="hidden" name="calendar3.month.long.april" value="April"><input type="hidden" name="calendar3.month.long.october" value="October"><input type="hidden" name="calendar3.month.long.august" value="August"><input type="hidden" name="calendar3.month.short.july" value="Jul"><input type="hidden" name="calendar3.month.short.may" value="May"><input type="hidden" name="calendar3.month.short.november" value="Nov"><input type="hidden" name="calendar3.day.long.friday" value="Friday"><input type="hidden" name="calendar3.day.long.sunday" value="Sunday"><input type="hidden" name="calendar3.day.long.saturday" value="Saturday"><input type="hidden" name="calendar3.month.short.april" value="Apr"><input type="hidden" name="calendar3.day.long.wednesday" value="Wednesday"><input type="hidden" name="calendar3.month.long.december" value="December"><input type="hidden" name="calendar3.month.short.october" value="Oct"><input type="hidden" name="calendar3.day.long.monday" value="Monday"><input type="hidden" name="calendar3.month.short.june" value="Jun"><input type="hidden" name="calendar3.day.short.monday" value="Mon"><input type="hidden" name="calendar3.day.short.tuesday" value="Tue"><input type="hidden" name="calendar3.day.short.saturday" value="Sat"><input type="hidden" name="calendar3.month.long.march" value="March"><input type="hidden" name="calendar3.month.long.june" value="June"><input type="hidden" name="calendar3.month.short.february" value="Feb"><input type="hidden" name="calendar3.month.short.august" value="Aug"><input type="hidden" name="calendar3.month.short.december" value="Dec"><input type="hidden" name="calendar3.day.short.sunday" value="Sun"><input type="hidden" name="calendar3.month.long.february" value="February"><input type="hidden" name="calendar3.day.long.tuesday" value="Tuesday"><input type="hidden" name="calendar3.month.long.may" value="May"><input type="hidden" name="calendar3.month.long.september" value="September"><input type="hidden" name="calendar3.month.long.november" value="November"><input type="hidden" name="calendar3.month.short.january" value="Jan"><input type="hidden" name="calendar3.month.short.september" value="Sep"><input type="hidden" name="calendar3.day.long.thursday" value="Thursday"><input type="hidden" name="calendar3.month.long.january" value="January"><input type="hidden" name="calendar3.day.short.friday" value="Fri"></fieldset></script>
<meta name="ajs-is-confluence-admin" content="false">
<meta name="ajs-connection-timeout" content="10000">
<meta name="ajs-page-id" content="31430329">
<meta name="ajs-latest-page-id" content="31430329">
<meta name="ajs-content-type" content="page">
<meta name="ajs-page-title" content="Making cross-origin HTTP requests">
<meta name="ajs-parent-page-title" content="Cookbook">
<meta name="ajs-parent-page-id" content="31429528">
<meta name="ajs-space-key" content="DEVELOPER">
<meta name="ajs-space-name" content="Developer">
<meta name="ajs-from-page-title" content="">
<meta name="ajs-can-remove-page" content="false">
<meta name="ajs-context-path" content="">
<meta name="ajs-base-url" content="https://doc.ez.no">
<meta name="ajs-version-number" content="5.8.5">
<meta name="ajs-build-number" content="5983">
<meta name="ajs-remote-user" content="">
<meta name="ajs-remote-user-key" content="">
<meta name="ajs-current-user-fullname" content="">
<meta name="ajs-current-user-avatar-url" content="">
<meta name="ajs-static-resource-url-prefix" content="/s/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/_">
<meta name="ajs-global-settings-attachment-max-size" content="10485760">
<meta name="ajs-user-locale" content="en_GB">
<meta name="ajs-enabled-dark-features" content="confluence-inline-comments-resolved,notification.plugin.api.enabled.com.atlassian.confluence.plugins.sharepage.api.ShareContentEvent,notification.plugin.api.enabled.com.atlassian.confluence.plugins.mentions.api.ConfluenceMentionEvent,notification.plugin.api.enabled.com.atlassian.confluence.event.events.security.ForgotPasswordEvent,pdf-preview,notification.plugin.api.enabled.com.atlassian.confluence.plugins.tasklist.event.SendTaskEmailEvent,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.page.async.PageMovedEvent,previews.sharing,previews.versions,notification.plugin.api.enabled.com.atlassian.confluence.plugins.files.notifications.event.FileContentUpdateEvent,file-annotations,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.attachment.AttachmentBatchUploadCompletedEvent,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.comment.CommentCreateEvent,notification.plugin.api.enabled.com.atlassian.confluence.efi.emails.events.OnboardingLessUsersEvent,notification.plugin.api.enabled.com.atlassian.confluence.plugins.files.notifications.event.FileContentRemoveEvent,atlassian.aui.raphael.disabled,previews.conversion-service,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.comment.CommentUpdateEvent,notification.plugin.api.enabled.com.atlassian.confluence.event.events.follow.FollowEvent,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.page.async.PageEditedEvent,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.blogpost.BlogPostCreateEvent,previews.trigger-all-file-types,notification.plugin.api.enabled.com.atlassian.confluence.plugins.inlinecomments.events.InlineCommentResolveEvent,notification.plugin.api.enabled.com.atlassian.confluence.event.events.like.LikeCreatedEvent,notification.plugin.api.enabled.com.atlassian.confluence.plugins.inlinecomments.events.InlineCommentCreateEvent,previews.sharing.pushstate,confluence-inline-comments-rich-editor,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.blogpost.BlogPostUpdateEvent,file-annotations.likes,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.page.async.PageCreatedEvent,notification.plugin.api.enabled.com.atlassian.confluence.plugins.files.notifications.event.FileContentMentionUpdateEvent,notification.plugin.api.enabled.com.atlassian.confluence.efi.emails.events.OnboardingNoSpaceCreatedEvent,notification.plugin.api.enabled.com.atlassian.confluence.plugins.hipchat.api.events.HipChatUserMapped,notification.plugin.api.enabled.com.atlassian.confluence.plugins.sharepage.api.ShareAttachmentEvent,confluence-inline-comments,confluence-inline-comments-dangling-comment,notification.plugin.api.enabled.com.atlassian.confluence.event.events.content.blogpost.BlogPostMovedEvent">
<meta name="ajs-atl-token" content="9996d8127abd36d1b757536de859090f8b455d10">
<meta name="ajs-confluence-flavour" content="VANILLA">
<meta name="ajs-user-date-pattern" content="dd MMM yyyy">
<meta name="ajs-date.format" content="MMM dd, yyyy">
<link rel="shortcut icon" href="../../s/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/_/favicon.ico">
<link rel="icon" type="image/x-icon" href="../../s/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/_/favicon.ico">
<link rel="search" type="application/opensearchdescription+xml" href="../../opensearch/osd.action" title="eZ Documentation"/>
<script>
window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\"\"";
WRM._unparsedData["com.atlassian.plugins.atlassian-nps-plugin:atlassian-nps-plugin-resources.is-server-instance-data-provider"]="true";
WRM._unparsedData["com.atlassian.plugins.browser.metrics.browser-metrics-plugin:browser-metrics.feature-data-provider-legacy"]="true";
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-rest:web-resource-manager.resource-base-url-pattern"]="\"(?:(?:/s/.*?/_)?/download)\"";
WRM._unparsedData["com.atlassian.confluence.plugins.confluence-license-banner:confluence-license-banner-resources.license-details"]="{\"daysBeforeLicenseExpiry\":0,\"daysBeforeMaintenanceExpiry\":0,\"showLicenseExpiryBanner\":false,\"showMaintenanceExpiryBanner\":false,\"renewUrl\":null,\"salesEmail\":null}";
WRM._unparsedData["com.atlassian.confluence.plugins.confluence-hipchat-integration-plugin:discovery-javascript-data.link-active"]="{\"linkActive\":false,\"conditionsMet\":true,\"admin\":false}";
WRM._unparsedData["com.atlassian.plugins.atlassian-nps-plugin:nps-acknowledgement-resources.analytics-enabled-data-provider"]="\"false\"";
WRM._unparsedData["com.atlassian.plugins.atlassian-nps-plugin:nps-acknowledgement-resources.sen-data-provider"]="\"SEN-2255945\"";
WRM._unparsedData["com.atlassian.confluence.plugins.confluence-feature-discovery-plugin:confluence-feature-discovery-plugin-resources.test-mode"]="false";
WRM._unparsedData["com.atlassian.plugins.browser.metrics.browser-metrics-plugin:api.feature-data-provider"]="true";
</script>
<link type="text/css" rel="stylesheet" href="../../s/1b9968ac17721e3a6947d14e3a43c3f8-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/89/_/download/superbatch/css/batch9c16.css?build-number=5983" media="all">
<!--[if lt IE 9]>
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/89/_/download/superbatch/css/batch.css?conditionalComment=lt+IE+9" media="all">
<![endif]-->
<!--[if lte IE 9]>
<link type="text/css" rel="stylesheet" href="/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/89/_/download/superbatch/css/batch.css?conditionalComment=lte+IE+9" media="all">
<![endif]-->
<link type="text/css" rel="stylesheet" href="../../s/fcf875d0c4710a8c828036f5c6fb7fa5-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/b8d35340d2d85de2791f14a4692ecf7b/_/download/contextbatch/css/atl.confluence.plugins.pagetree-desktop%2cmain%2cvi/batchd6a4.css?highlightactions=true&flavour=VANILLA&locale=en-GB" media="all">
<!--[if lt IE 9]>
<link type="text/css" rel="stylesheet" href="/s/6c0981174e94142364564819dc0d1413-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/b8d35340d2d85de2791f14a4692ecf7b/_/download/contextbatch/css/atl.confluence.plugins.pagetree-desktop,main,viewcontent,atl.general,page,atl.comments/batch.css?conditionalComment=lt+IE+9&locale=en-GB" media="all">
<![endif]-->
<!--[if lte IE 9]>
<link type="text/css" rel="stylesheet" href="/s/7893b9affdc3bf828ad93d0610d3d5f3-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/b8d35340d2d85de2791f14a4692ecf7b/_/download/contextbatch/css/atl.confluence.plugins.pagetree-desktop,main,viewcontent,atl.general,page,atl.comments/batch.css?conditionalComment=lte+IE+9" media="all">
<![endif]-->
<link type="text/css" rel="stylesheet" href="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/3a21f7b21af4c67045d1e0255f2ac570/_/download/contextbatch/css/theme.doc/batch.css" media="all">
<link type="text/css" rel="stylesheet" href="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.1.7/_/download/batch/com.atlassian.confluence.ext.newcode-macro-plug/com.atlassian.confluence.ext.newcode-macro-plugin_syntaxhighl" media="all">
<link type="text/css" rel="stylesheet" href="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.1.7/_/download/batch/com.atlassian.confluence.ext.newcode-macro-plug/com.atlassian.confluence.ext.newcode-macro-plugin_sh-theme-ec" media="all">
<link type="text/css" rel="stylesheet" href="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.8.6/_/download/batch/org.randombits.confluence.toc_toc-plugin-styles/org.randombits.confluence.toc_toc-plugin-styles.css" media="all">
<link type="text/css" rel="stylesheet" href="../../s/dfa57710662c34cadfcdc17e2cded5b2-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/3.0.11/_/download/batch/confluence.extra.livesearch_livesearch-macro-we/confluence.extra.livesearch_livesearch-macro-web-resources.9" media="all">
<link type="text/css" rel="stylesheet" href="../../s/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/6/_/styles/colors74cd.css?spaceKey=DEVELOPER" media="all">
<link type="text/css" rel="stylesheet" href="../../s/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/6/_/styles/custom74cd.css?spaceKey=DEVELOPER" media="all">
<script type="text/javascript" src="../../s/1f7b22082ef39a4bb134622dae929bdc-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/89/_/download/superbatch/js/batch32f4.js?atlassian.aui.raphael.disabled=true&locale=en-GB&build-number=5983" ></script>
<script type="text/javascript" src="../../s/aa56759c03dcb293b394c4b46058625c-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/b8d35340d2d85de2791f14a4692ecf7b/_/download/contextbatch/js/atl.confluence.plugins.pagetree-desktop%2cmain%2cvi/batcha41c.js?highlightactions=true&flavour=VANILLA&locale=en-GB&anonymous-access-enabled=true&is-server-instance=true&hostenabled=true" ></script>
<script type="text/javascript" src="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.1.7/_/download/batch/com.atlassian.confluence.ext.newcode-macro-plug/com.atlassian.confluence.ext-2.newcode-macro-plugin_syntaxhighl" ></script>
<script type="text/javascript" src="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.1.7/_/download/batch/com.atlassian.confluence.ext.newcode-macro-plug/com.atlassian.confluence.ext-3.newcode-macro-plugin_syntaxhighl" ></script>
<script type="text/javascript" src="../../s/6c0981174e94142364564819dc0d1413-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.1.7/_/download/batch/com.atlassian.confluence.ext.newcode-macro-plug/com.atlassian.confluence.ext.newcode-macro-plugin_syntaxhighl?locale=en-GB" ></script>
<script type="text/javascript" src="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.8.6/_/download/batch/org.randombits.confluence.toc_client-side-toc-r/org.randombits.confluence.toc_client-side-toc-resources.cf.de" ></script>
<script type="text/javascript" src="../../s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/2.8.6/_/download/batch/org.randombits.confluence.toc_toc-plugin-analytics/org.randombits.confluence.toc_toc-plugin-analytics.js" ></script>
<script type="text/javascript" src="../../s/6c0981174e94142364564819dc0d1413-CDN/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/3.0.11/_/download/batch/confluence.extra.livesearch_livesearch-macro-we/confluence.extra.livesearch_livesearch-macro-web-resources.a?locale=en-GB" ></script>
<meta name="stp-license-product-name" content="Confluence"/> <meta name="stp-license-days-to-expiry" content="807"/> <meta name="stp-license-is-admin" content="false"/> <meta name="stp-license-should-keep-banner-hidden" content="true"/>
<meta name="ajs-site-title" content="eZ Documentation" />
<link rel="canonical" href="Making%2bcross-origin%2bHTTP%2brequests.html">
<link rel="shortlink" href="Making%2bcross-origin%2bHTTP%2brequests.html">
<meta name="wikilink" content="[DEVELOPER:Making cross-origin HTTP requests]">
<meta name="page-version" content="3">
</head>
<body onload="placeFocus()"
id="com-atlassian-confluence" class="theme-documentation aui-theme-default aui-layout">
<div id='stp-licenseStatus-banner'></div>
<div id="full-height-container">
<div id="header-precursor">
</div>
<header id="header" role="banner">
<nav class="aui-header aui-dropdown2-trigger-group" role="navigation"><div class="aui-header-inner"><div class="aui-header-before"><a class=" aui-dropdown2-trigger app-switcher-trigger" aria-owns="app-switcher" aria-controls="app-switcher" aria-haspopup="true" data-aui-trigger href="#app-switcher"><span class="aui-icon aui-icon-small aui-iconfont-appswitcher">Linked Applications</span></a><div id="app-switcher" class="aui-dropdown2 aui-style-default"><div class="app-switcher-loading">Loading…</div></div><script>
(function (NL) {
var initialise = function () {
// For some milestones of AUI, the atlassian soy namespace was renamed to aui. Handle that here by ensuring that window.atlassian is defined.
window.atlassian = window.atlassian || window.aui;
new NL.AppSwitcher({
dropdownContents: '#app-switcher'
});
};
if (NL.AppSwitcher) {
initialise();
} else {
NL.onInit = initialise;
}
}(window.NL = (window.NL || {})));
window.NL.isUserAdmin = false</script></div><div class="aui-header-primary"><h1 id="logo" class="aui-header-logo aui-header-logo-custom"><a href="../../index.html"><img src="../../s/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/_/images/logo/atl.site.logo" alt="eZ Documentation" /></a></h1><ul class="aui-nav">
<li>
<a id="space-directory-link" href="../../spacedirectory/view.html" class=" aui-nav-imagelink" title="Spaces">
<span>Spaces</span>
</a>
</li>
<li id="browseMenu" role="menu">
<a id="browse-menu-link" class="aui-nav-link aui-dropdown2-trigger" href="#" aria-haspopup="true" aria-owns="browse-menu-link-content" title="Browse">
<span class="browse">Browse</span>
</a>
<nav id="browse-menu-link-content" class="aui-dropdown2 aui-style-default" aria-hidden="true">
<div class="aui-dropdown2-section">
<ul id="browse-menu-link-leading" class="aui-list-truncate section-leading first">
<li>
<a id="space-pages-link" href="../../pages/listpages-dirviewda82.html?key=DEVELOPER" class=" " title="Browse pages in the Developer space" >
Pages
</a>
</li>
<li>
<a id="space-blogposts-link" href="../../pages/viewrecentblogpostsda82.html?key=DEVELOPER" class=" " title="Browse blogs in the Developer space" >
Blog
</a>
</li>
<li>
<a id="space-labels-link" href="../../labels/listlabels-heatmapda82.html?key=DEVELOPER" class=" " title="Browse labels in the Developer space" >
Labels
</a>
</li>
<li>
<a id="space-advanced-link" href="../../spaces/viewspacesummaryda82.html?key=DEVELOPER" class=" " title="Browse additional space functions in the Developer space" >
Space Operations
</a>
</li>
</ul>
</div>
</nav>
</li>
</ul>
</div><div class="aui-header-secondary"><ul class="aui-nav">
<li>
<a id="doctheme-anchor" href="#" class=" aui-nav-imagelink" title="">
<span></span>
</a>
</li>
<li>
<form id="quick-search" class="aui-quicksearch dont-default-focus header-quicksearch" action="https://doc.ez.no/dosearchsite.action" method="get"><fieldset><label for="quick-search-query" class="assistive">Quick Search</label><input id="quick-search-query" class="text app-search search quick-search-query" type="text" accessKey="q" autocomplete="off" name="queryString" title="Quick Search" placeholder="Search" /><input id="quick-search-submit" class="quick-search-submit" type="submit" value="Search"/><div class="aui-dd-parent quick-nav-drop-down"></div></fieldset></form>
</li>
<li>
<a id="help-menu-link" class="aui-nav-link aui-dropdown2-trigger" href="#" aria-haspopup="true" aria-owns="help-menu-link-content" title="Help">
<span class="aui-icon aui-icon-small aui-iconfont-help">Help</span>
</a>
<nav id="help-menu-link-content" class="aui-dropdown2 aui-style-default" aria-hidden="true">
<div class="aui-dropdown2-section">
<ul id="help-menu-link-leading" class="aui-list-truncate section-leading first">
<li>
<a id="confluence-help-link" href="https://docs.atlassian.com/confluence/docs-58/Getting+Help+And+Support" class=" " title="Visit the Confluence documentation home" target="_blank"
>
Online Help
</a>
</li>
<li>
<a id="keyboard-shortcuts-link" href="#" class=" " title="View available keyboard shortcuts" >
Keyboard Shortcuts
</a>
</li>
<li>
<a id="feed-builder-link" href="../../dashboard/configurerssfeed.html" class=" " title="Create your custom RSS feed." >
Feed Builder
</a>
</li>
<li>
<a id="whats-new-menu-link" href="https://docs.atlassian.com/confluence/docs-58/whatsnew/iframe" class=" " title="" >
What’s new
</a>
</li>
<li>
<a id="gadget-directory-link" href="#" class=" user-item administration-link " title="Browse gadgets provided by Confluence" >
Available Gadgets
</a>
</li>
<li>
<a id="confluence-about-link" href="../../aboutconfluencepage.html" class=" " title="Get more information about Confluence" >
About Confluence
</a>
</li>
</ul>
</div>
</nav>
</li>
<li>
</li>
<li>
</li>
<li>
<li>
<a id="login-link" href="../../login1f71.html?os_destination=%2Fdisplay%2FDEVELOPER%2FMaking%2Bcross-origin%2BHTTP%2Brequests" class=" user-item login-link " title="" >
Log in
</a>
</li>
</li>
</ul>
</div></div><!-- .aui-header-inner--></nav><!-- .aui-header -->
<br class="clear">
</header>
<div id="splitter">
<div id="splitter-sidebar" >
<p> </p>
<h4><a name="Makingcross-originHTTPrequests-&nbsp;General"></a> General</h4>
<p><font color="#999">•</font> <a href="http://ez.no/" class="external-link" rel="nofollow">eZ Systems Website</a><br/>
<font color="#999">•</font> <a href="../USER.html" class="external-link" rel="nofollow">Editor documentation</a></p>
<hr />
<h4><a name="Makingcross-originHTTPrequests-&nbsp;Developerdocumentation"></a> Developer documentation</h4>
<p> <sup><a href="Documentation.html" class="external-link" rel="nofollow">Back to the top</a></sup><br/>
<div class="search-macro search-macro-medium">
<div class="aui-dd-parent"></div>
<form class="aui aui-dd-parent" name="livesearchForm" method="POST" action="https://doc.ez.no/dosearchsite.action">
<fieldset class="search-macro-fields">
<div class="search-macro-query">
<input class="text" type="text" name="queryString" autocomplete="off" placeholder="search Developer docs">
</div>
<button type="submit" class="search-macro-button aui-button">
<span class="aui-icon aui-icon-small aui-iconfont-search">Search</span>
</button>
<input type="hidden" name="where" value="DEVELOPER">
<input type="hidden" name="additional" value="space name">
<input type="hidden" name="labels" value="">
<input type="hidden" name="contentType" value="page">
</fieldset>
</form>
</div>
</p>
<div class="plugin_pagetree">
<ul class="plugin_pagetree_children_list plugin_pagetree_children_list_noleftspace">
<div class="plugin_pagetree_children">
</div>
</ul>
<fieldset class="hidden">
<input type="hidden" name="treeId" value="">
<input type="hidden" name="treeRequestId" value="/plugins/pagetree/naturalchildren.action?decorator=none&excerpt=false&sort=position&reverse=false&disableLinks=false&expandCurrent=false">
<input type="hidden" name="treePageId" value="31430329">
<input type="hidden" name="noRoot" value="false">
<input type="hidden" name="rootPageId" value="31429504">
<input type="hidden" name="rootPage" value="">
<input type="hidden" name="startDepth" value="0">
<input type="hidden" name="spaceKey" value="DEVELOPER" >
<input type="hidden" name="i18n-pagetree.loading" value="Loading...">
<input type="hidden" name="i18n-pagetree.error.permission" value="Unable to load page tree. It seems that you do not have permission to view the root page.">
<input type="hidden" name="i18n-pagetree.eeror.general" value="There was a problem retrieving the page tree. Please check the server log file for more information.">
<input type="hidden" name="loginUrl" value="/login.action?os_destination=%2Fpages%2Fviewpage.action%3FspaceKey%3DDEVELOPER%26title%3DMaking%2Bcross-origin%2BHTTP%2Brequests">
<input type="hidden" name="mobile" value="false">
<fieldset class="hidden">
<input type="hidden" name="ancestorId" value="31429528">
<input type="hidden" name="ancestorId" value="31429504">
</fieldset>
</fieldset>
</div>
</div>
<div id="splitter-content">
<script type="text/javascript" src="../../s/en_GB/5983/f3e491afc761ac0a6981cfa3dcbc04fc7e88c149.16/5.8.5/_/download/resources/com.atlassian.confluence.plugins.doctheme_resources/doc-theme.js"></script>
<div id="main" class="aui-page-panel" >
<div id="main-header">
<div id="navigation" class="content-navigation view">
<ul class="ajs-menu-bar">
<li class="normal ajs-menu-item">
<a id="action-menu-link" class="action aui-dropdown2-trigger-arrowless aui-button aui-button-subtle ajs-menu-title aui-dropdown2-trigger" href="#" aria-haspopup="true" aria-owns="action-menu" data-container="#navigation">
<span>
<span class="aui-icon aui-icon-small aui-iconfont-more"></span>
</span>
</a> <div id="action-menu" class="aui-dropdown2 aui-style-default">
<ul id="action-menu-primary" class="section-primary first aui-dropdown2-section">
<li>
<a id="view-attachments-link" href="../../pages/viewpageattachments8b7a.html?pageId=31430329" rel="nofollow" class="action-view-attachments" accessKey="t" title="View Attachments">
<span>
A<u>t</u>tachments (0)
</span> </a>
</li>
<li>
<a id="action-view-history-link" href="../../pages/viewpreviousversions8b7a.html?pageId=31430329" rel="nofollow" class="action-view-history" title="">
<span>
Page History
</span> </a>
</li>
<li>
<a id="action-page-permissions-link" href="../../pages/viewinfo8b7a.html?pageId=31430329" rel="nofollow" class="action-page-permissions" title="Edit restrictions">
<span>
Restrictions
</span> </a>
</li>
</ul>
<ul id="action-menu-secondary" class="section-secondary aui-dropdown2-section">
<li>
<a id="view-page-info-link" href="../../pages/viewinfo8b7a.html?pageId=31430329" rel="nofollow" class="action-view-info" title="">
<span>
Page Information
</span> </a>
</li>
<li>
<a id="view-resolved-comments" href="#" rel="nofollow" class="" title="">
<span>
Resolved comments
</span> </a>
</li>
<li>
<a id="link-to-page-link" href="../../pages/viewinfo8b7a.html?pageId=31430329" rel="nofollow" class="" title="Link to this Page">
<span>
Link to this Page…
</span> </a>
</li>
<li>
<a id="view-in-hierarchy-link" href="../../pages/listpages-dirviewd14a.html?key=DEVELOPER&openId=31430329#selectedPageInHierarchy" rel="nofollow" class="" title="">
<span>
View in Hierarchy
</span> </a>
</li>
<li>
<a id="action-view-source-link" href="../../plugins/viewsource/viewpagesrc8b7a.html?pageId=31430329" rel="nofollow" class="action-view-source popup-link" title="">
<span>
View Source
</span> </a>
</li>
<li>
<a id="action-export-pdf-link" href="../../download/temp/pdfexport-20170131-310117-0819-2417/DEVELOPER-Makingcross-originHTTPrequests-310117-0819-2418f1f7.pdf?pageId=31430329" rel="nofollow" class="" title="">
<span>
Export to PDF
</span> </a>
</li>
<li>
<a id="action-export-word-link" href="../../exportword8b7a?pageId=31430329" rel="nofollow" class="action-export-word" title="">
<span>
Export to Word
</span> </a>
</li>
</ul>
</div>
</li>
</ul>
</div>
<div id="title-heading" class="pagetitle with-breadcrumbs">
<div class="space-logo " data-key="DEVELOPER" data-name="Developer" data-entity-type="confluence.space">
<a><img class="logo global custom" src="../../download/attachments/327681/globalbff7.logo?version=1&modificationDate=1434758222000&api=v2" alt=""></a>
</div>
<div id="breadcrumb-section">
<ol id="breadcrumbs">
<li class="first" >
<span class=""><a href="Documentation.html">Developer</a></span>
<li>
<span class=""><a href="Documentation.html">Documentation</a></span>
<li>
<span class=""><a href="Cookbook.html">Cookbook</a></span>
</ol>
</div>
<h1 id="title-text" class="with-breadcrumbs">
<a href="Making%2bcross-origin%2bHTTP%2brequests.html">Making cross-origin HTTP requests</a>
</h1>
</div>
</div>
<div id="content" class="page view">
<div id="action-messages">
</div>
<script type="text/x-template" title="searchResultsGrid">
<table class="aui">
<thead>
<tr class="header">
<th class="search-result-title">Page Title</th>
<th class="search-result-space">Space</th>
<th class="search-result-date">Updated</th>
</tr>
</thead>
</table>
</script>
<script type="text/x-template" title="searchResultsGridCount">
<p class="search-result-count">{0}</p>
</script>
<script type="text/x-template" title="searchResultsGridRow">
<tr class="search-result">
<td class="search-result-title"><a href="{1}" class="content-type-{2}"><span>{0}</span></a></td>
<td class="search-result-space"><a class="space" href="/display/{4}/" title="{3}">{3}</a></td>
<td class="search-result-date"><span class="date" title="{6}">{5}</span></td>
</tr>
</script>
<fieldset class="hidden parameters">
<input type="hidden" title="parentPageId" value="31429528">
</fieldset>
<a href="#page-metadata-end" class="assistive">Skip to end of metadata</a>
<div id="page-metadata-start" class="assistive"></div>
<div class="page-metadata">
<ul>
<li class="page-metadata-item noprint">
<a id="content-metadata-page-restrictions" href="#" rel="nofollow" class="hidden" title="Restrictions apply">
<img alt="" src="../../download/resources/com.atlassian.confluence.plugins.confluence-page-banner_page-banner-resources/images/red_padlock.png" height="16" width="16" title="">
<span>
</span> </a>
</li>
<li class="page-metadata-modification-info">
Created by <span class='author'> <a href="../../loginee65.html"
class="url fn"
>Dominika Kurek</a></span>, last modified on <a class='last-modified' title='Show changes' href='../../pages/diffpagesbyversion3502.html?pageId=31430329&selectedPageVersions=2&selectedPageVersions=3'>May 17, 2016</a>
</li>
</ul>
</div>
<a href="#page-metadata-start" class="assistive">Go to start of metadata</a>
<div id="page-metadata-end" class="assistive"></div>
<fieldset class="hidden parameters">
<input type="hidden" title="browsePageTreeMode" value="view">
</fieldset>
<div id="main-content" class="wiki-content">
<div class="contentLayout2">
<div class="columnLayout two-right-sidebar" data-layout="two-right-sidebar">
<div class="cell normal" data-type="normal">
<div class="innerCell">
<h1 id="Makingcross-originHTTPrequests-Description">Description</h1><p>eZ Publish ships with <a href="https://github.com/nelmio/NelmioCorsBundle" class="external-link" rel="nofollow">NelmioCorsBundle</a>, a Symfony open-source bundle that provides support for <a href="http://www.w3.org/TR/cors/" class="external-link" rel="nofollow">CORS (Cross Origin Resource Sharing)</a>. The REST API is pre-configured to respond to such requests, as long as you customize the allowed origins as explained below.</p><h2 id="Makingcross-originHTTPrequests-WhatisCORS">What is CORS</h2><p>Supported by most modern browsers, this W3C specification defines a set of custom headers that, under specific circumstances, allow HTTP requests between different hosts. The main use-case is execution of AJAX code from one site towards another.</p><p>A couple links about it:</p><ul><li> <a href="http://www.w3.org/TR/cors/" class="external-link" rel="nofollow">W3C specification</a></li><li>an excellent <a href="http://www.html5rocks.com/en/tutorials/cors/" class="external-link" rel="nofollow">tutorial about CORS on html5rocks.com</a></li><li><a href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS" class="external-link" rel="nofollow">overview of CORS on developer.mozilla.org</a></li></ul><h1 id="Makingcross-originHTTPrequests-Solution">Solution</h1><h2 id="Makingcross-originHTTPrequests-Configuration">Configuration</h2><p>Since CORS support is provided by a 3rd party bundle, we re-use the semantical configuration it provides. You can read more about it on the <a href="https://github.com/nelmio/NelmioCorsBundle/blob/master/README.md" class="external-link" rel="nofollow">NelmiCorsBundle's README</a> file.</p><p>The origin of a request is one of the main criteria for allowing or blocking a cross origin request. Such requests will come with an Origin HTTP header, automatically added by the browser, that gets approved/blocked by the server. By default, all cross origin requests will be blocked.</p><h3 id="Makingcross-originHTTPrequests-Grantinganorigindefaultaccess">Granting an origin default access</h3><p>To allow a specific host to execute cross-origin requests, you need to add this host to the <code>nelmio_cors.default.allow_origin</code> configuration array in <code>config.yml</code>. As an example, in order to allow requests from <a href="http://example.com,/" class="external-link" rel="nofollow">http://example.com,</a> one would add those lines to <code>ezpublish/config/config.yml</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script type="syntaxhighlighter" class="brush: php; gutter: false; theme: Eclipse"><![CDATA[nelmio_cors:
defaults:
allow_origin: [ 'http://example.com' ] ]]></script>
</div></div><h3 id="Makingcross-originHTTPrequests-GrantingCORSaccesstoyourownHTTPresources">Granting CORS access to your own HTTP resources</h3><p>The Cors bundle is of course perfectly safe to use for any non-eZ HTTP resource you would like to expose.<br />Follow the instructions in <a href="https://github.com/nelmio/NelmioCorsBundle/blob/master/README.md#configuration" class="external-link" rel="nofollow">NelmioCorsBundle's configuration chapter</a>.</p></div>
</div>
<div class="cell aside" data-type="aside">
<div class="innerCell">
<h4 id="Makingcross-originHTTPrequests-Inthistopic:">In this topic:</h4><p><div class="toc-macro client-side-toc-macro " data-headerelements="H1,H2,H3"></div></p></div>
</div>
</div>
</div>
</div>
<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="https://doc.ez.no/display/DEVELOPER/Making+cross-origin+HTTP+requests"
dc:identifier="https://doc.ez.no/display/DEVELOPER/Making+cross-origin+HTTP+requests"
dc:title="Making cross-origin HTTP requests"
trackback:ping="https://doc.ez.no/rpc/trackback/31430329"/>
</rdf:RDF>
-->
<div id="labels-section" class="pageSection group">
<div class="labels-section-content content-column" entityid="31430329" entitytype="page">
<div class="labels-content">
<ul class="label-list label-list-right ">
<li class="aui-label " data-label-id="13336585"><a class="aui-label-split-main" href="../../label/DEVELOPER/api.html" rel="tag">api</a></li><li class="aui-label " data-label-id="20971538"><a class="aui-label-split-main" href="../../label/DEVELOPER/rest.html" rel="tag">rest</a></li><li class="aui-label " data-label-id="31883302"><a class="aui-label-split-main" href="../../label/DEVELOPER/recipe.html" rel="tag">recipe</a></li>
</ul>
</div>
</div>
</div>
<div id="comments-section" class="pageSection group">
</div>
</div>
</div>
<div id="theme-footer">
<p>© 1999-2016 <a href="http://ez.no/" class="external-link" rel="nofollow">eZ Systems AS</a> and others</p>
</div>
</div>
</div>
<div id="footer" role="contentinfo">
<section class="footer-body">
<p class="license license-opensource">
Powered by a free <b>Atlassian Confluence Open Source Project License</b> granted to eZ Publish. <a href="http://www.atlassian.com/c/conf/11461">Evaluate Confluence today</a>.<br>
</p>
<ul id="poweredby">
<li class="noprint">Powered by <a href="http://www.atlassian.com/software/confluence" class="hover-footer-link">Atlassian Confluence</a> <span id='footer-build-information'>5.8.5</span>, <a href="http://www.atlassian.com/software/confluence/overview/team-collaboration-software?utm_source=confluence-footer" class="hover-footer-link">Team Collaboration Software</a></li>
<li class="print-only">Printed by Atlassian Confluence 5.8.5, Team Collaboration Software.</li>
<li class="noprint"><a href="https://jira.atlassian.com/browse/CONF" class="hover-footer-link">Report a bug</a></li>
<li class="noprint"><a href="http://www.atlassian.com/about/connected.jsp?s_kwcid=Confluence-stayintouch" class="hover-footer-link">Atlassian News</a></li>
</ul>
<div id="footer-logo"><a href="http://www.atlassian.com/">Atlassian</a></div>
<script>
AJS.toInit(function(){
if(AJS.params.spaceKey &&
AJS.params.spaceKey === 'MAIN' ||
AJS.params.spaceKey === 'EZMA' ||
AJS.params.spaceKey === 'ODC' ||
AJS.params.spaceKey === 'EZP50' ||
AJS.params.spaceKey === 'EZP51' ||
AJS.params.spaceKey === 'EZP52' ||
AJS.params.spaceKey === 'EZPCLOUD' ||
AJS.params.spaceKey === 'EZP' ||
AJS.params.spaceKey === 'TECHDOC' ||
AJS.params.spaceKey === 'USERGUIDE' ||
AJS.params.spaceKey === 'EZRECO'
){
(function()
{var isSecure=('https:'==document.location.protocol);var ff=document.createElement('script');ff.type='text/javascript';ff.async=true;ff.src=(isSecure?'https':'http')+'://'+(isSecure?'secure.':'lb.')+'liveviewer.ez.no/statjs/sst-120-1304513615/stat.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ff,s);}
)();
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','http://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-303624-13', 'ez.no');
ga('send', 'pageview');
}}
);
</script>
</section>
</div>
</div>
</body>
<!-- Mirrored from doc.ez.no/display/DEVELOPER/Making+cross-origin+HTTP+requests by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 31 Jan 2017 08:19:32 GMT -->
</html>