-
Suggestion
-
Resolution: Tracked Elsewhere
-
None
-
We use confluence on a standalone server
NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.
The problem:
When you use JSONP to access the REST-API you can't set the access header. And therefore Confluence returns the default XML document, witch can't be read by javascript when you do cross origin requests.
How to reproduce the problem:
- open the attached confluenceRestFail.html file
- open the javascript console on you web browser
- see the error message because it can't interpret the "<" in the beginning of the XML document it gets back.
Suggested fix:
Confluence could use the jsonp-callback= GET parameter to set the return type to JSON instead of XML. Because the jsonp-callback= parameter is pretty useless for a xml request...
Why you can't set the Accept header in javascript when using JSONP
You can't set the access header because when you use JSONP the tool of you choice creates a <script> element and sets the "src" attribute to the URL you want. And you can't set a Accept: "application/json" on a <script> element. Therefore your Accept headers looks like this: Accept: */* and that in turn results in confluence returning XML.
- is superseded by
-
CONFSERVER-58472 REST API Cross Domain Access Support
- Closed
- relates to
-
CONFCLOUD-31192 The REST-API should work with javascript (JSONP)
- Closed