2 réponses
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
Adding this answer to mark as most helpful: As suggested in a comment to another answer, the WAF had protections that was blocking the request.
répondu il y a 7 mois
0
Changing only the content -> text field to this { "id": "12345", "type": "info", "content": [ { "type": "text", "text": "<p style=""> Text </p>", "action": "add" } ], "title": "Title" } or { "id": "12345", "type": "info", "content": [ { "type": "text", "text": "<p style="color: rgb(230, 0, 0);">red text</p>", "action": "add" } ], "title": "Title" }
Are those inputs well-formatted JSON?
Look like you need to replace the double quotes in <p>
element to the single quotes, as below.
{ "id": "12345", "type": "info", "content": [ { "type": "text", "text": "<p style=''> Text </p>", "action": "add" } ], "title": "Title" }
{ "id": "12345", "type": "info", "content": [ { "type": "text", "text": "<p style='color: rgb(230, 0, 0);'>red text</p>", "action": "add" } ], "title": "Title" }
répondu il y a 8 mois
Contenus pertinents
- demandé il y a un an
- demandé il y a 2 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
I should have mentioned that I had already tried changing to single quotes, but using "<p style=''> Text </p>" and "<p style='color: rgb(230, 0, 0);'>red text</p>" also error
Does your API Gateway return an 200 response with "Access-Control-Allow-Origin" header if you test the method with the problematic inputs on the AWS Console? https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-test-method.html
Yes, using the AWS console with the problematic inputs succeeds with a 200 response, and returns the headers including Access-Control-Allow-Origin.
Hmm. Does your API Gateway have some protections (e.g., WAF)? The only possibility otherwise I can imagine is that some protections blocked your request and returned an error response without the CORS headers, so that the error message
No 'Access-Control-Allow-Origin' header is present on the requested resource.
arised.The WAF was the issue. Thank you for this suggestion