-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting CORS error when I use route /v1/graphql #2
Comments
@swapnil2525kangralkar With the Caddyfile you provided, I got the corresponding config in JSON as below: {
"apps": {
"http": {
"servers": {
"srv0": {
"routes": [
{
"handle": [
{
"routes": [
{
"handle": [
{
"rate": "50r/m",
"handler": "rate_limit",
"key": "{remote.ip}"
}
]
},
{
"handle": [
{
"status_code": 200,
"handler": "static_response"
}
]
}
],
"handler": "subroute"
}
],
"match": [
{
"path": [
"/v1/graphql"
]
}
]
},
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "graphql-engine:8080"
}
]
}
]
}
],
"listen": [
":8080"
]
}
}
}
}
} By changing the rate to $ curl -w "%{http_code}" 'http://localhost:8080/v1/graphql'
200
$ curl -w "%{http_code}" 'http://localhost:8080/v1/graphql'
200
$ curl -w "%{http_code}" 'http://localhost:8080/v1/graphql'
200
$ curl -w "%{http_code}" 'http://localhost:8080/v1/graphql'
200
$ curl -w "%{http_code}" 'http://localhost:8080/v1/graphql'
200
$ curl -w "%{http_code}" 'http://localhost:8080/v1/graphql'
429 |
|
Thanks @RussellLuo, |
CORS is a browser-related mechanism, see here for details. I guess that you have configured CORS headers for upstream
|
For anyone who needs to setup hasura graphql and caddy 2.0 with ratelimit ext (docker-compose).
Github: https://github.com/swapnil2525kangralkar/caddy_hasura_ratelimit |
I also get a CORS error when the limit happens, actually, first 100 request are ok until the user reaches the rate limit and it shows CORS error, any idea? |
Per the doc of Preflighted requests:
So if the OPTIONS request is limited, then you will encounter a CORS error. Try to just limit the actual request by using the method matcher. |
I am trying to limit
/v1/graphql
with ip but I am gettingCORS error
.If route
/v1
is used no error but api limit does not work./v1/*
,/v1*
these are also not working.Checking on localhost with docker-compose.
Please check below Caddyfile:
The text was updated successfully, but these errors were encountered: