You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I followed the recommendation about cors from the document, but I'm still get the following error:
Access to XMLHttpRequest at 'http:///api/v1/payment' from origin 'http://' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Hi I followed the recommendation about cors from the document, but I'm still get the following error:
Access to XMLHttpRequest at 'http:///api/v1/payment' from origin 'http://' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
This is my configuration:
endpoints:
[
{
"@comment": "this won't fail because CORS preflight headers are removed from the request to the backend",
"endpoint": "/api/v1/payment",
"input_headers": [
"*"
],
"output_encoding": "no-op",
"backend": [
{
"url_pattern": "/api/v1/payment",
"host": [
"http://*****"
],
"encoding": "no-op",
"extra_config": {
"modifier/martian": {
"fifo.Group": {
"scope": [
"request",
"response"
],
"aggregateErrors": true,
"modifiers": [
{
"header.Blacklist": {
"scope": [
"request"
],
"names": [
"Access-Control-Request-Method",
"Sec-Fetch-Dest",
"Sec-Fetch-Mode",
"Sec-Fetch-Site",
"Origin"
]
}
}
]
}
}
}
}
]
}
]
Krakend.json :
{
"version": 3,
"port": {{ marshal .service.port }},
"cache_ttl": {{ marshal .service.cache_ttl }},
"timeout": {{ marshal .service.timeout }},
"extra_config": {{ marshal .service.extra_config }},
"host": {{ marshal .service.default_hosts }},
"endpoints": [
{{ range $idx, $endpoint := .endpoint.example_group }}
{{if $idx}},{{end}}
{
"endpoint": "{{ $endpoint.endpoint }}",
"method": "{{ $endpoint.method }}",
"headers_to_pass":["*"],
"extra_config:":{{ marshal $endpoint.extra_config }},
"output_encoding": "no-op",
"backend": {{ marshal $endpoint.backend }}
}
{{ end }}
service.json
{
"port": 8080,
"cache_ttl": "3600s",
"timeout": "36s",
"default_hosts": [
"http://:30003",
"http://:30004",
"http://:30007"
],
"extra_config": {
"security/cors": {
"allow_origins": [
"http*"
],
"allow_methods": [
"GET",
"HEAD",
"POST",
"PUT",
"DELETE"
],
"expose_headers": [
"Content-Length",
"Content-Type"
],
"allow_headers": [
"Origin",
"Authorization",
"Content-Type",
"Cache-Control",
"Pragma",
"Accept-Language"
],
"max_age": "12h",
"allow_credentials": false,
"debug": false
},
"telemetry/logging": {
"level": "DEBUG",
"prefix": "[KRAKEND]",
"syslog": false,
"stdout": true
},
"telemetry/opencensus": {
"exporters": {
"jaeger": {
"endpoint": "/api/traces",
"service_name": "krakend",
"buffer_max_count": 1000
}
}
},
"telemetry/metrics": {
"collection_time": "60s",
"proxy_disabled": false,
"router_disabled": false,
"backend_disabled": false,
"endpoint_disabled": false,
"listen_address": ":8090"
}
}
}
Could you please tell me where I made a mistake?
Thanks
The text was updated successfully, but these errors were encountered: