Can I restrict access from overseas?
Where to configure the restriction depends on what you want to restrict.
| Target | How to restrict by country or region |
|---|---|
| Pages served by KurocoFront | Place KurocoEdge in front of KurocoFront and set a rule that checks the country of the request. |
| Kuroco API | Specify the countries allowed to access the API in [Country restriction] in the API [Security] settings. |
KurocoEdge restricts access only to pages served through KurocoEdge. If you also want to restrict access to the API called from your front end, set [Country restriction] for the API as well.
Restricting access to KurocoFront pages
KurocoFront settings (kuroco_front.json) have no setting to restrict access by country or region. To restrict access by country or region, use KurocoEdge.
Restricting access by country or region with KurocoEdge
In KurocoEdge rules, you can check the country of the request by specifying "CountryCode" of "Geolocation" as a condition.
For example, by returning 403 Forbidden with a "Synthetic response" to requests whose CountryCode is not JP, you can restrict access from outside Japan. You can also restrict access only from specific countries.
For the setup steps, see the following tutorial.
Restricting access by IP address
If you can identify the IP addresses to allow, you can set IP address restrictions with ip_restrictions in kuroco_front.json of KurocoFront.
"ip_restrictions":[
"111.111.111.111/32",
"222.222.222.222/32"
],
For details, see What is kuroco_front.json?.
Restricting access to the API
To restrict access to the Kuroco API, use [Country restriction] in the API [Security] settings.
In the side menu, click [API], select the target API, and click [Security]. Under [Access restriction], select the countries allowed to access the API in [Country restriction] and save. Requests from countries other than the selected ones are refused.
- When both [IP address restriction] and [Country restriction] are set, a request that matches either one is allowed.
- A request whose country cannot be determined is refused unless the IP address restriction allows it.
- A refused request receives the same error as the IP address restriction (
IP address is out of range.).
For details, see API security.
The country is determined from the source IP address and is not always accurate. Requests from users on business trips abroad and through VPNs or cloud services routed via overseas servers are also refused. Before configuring this setting, check the countries of incoming requests in the [Country code] column of the API log.
Related documents
Support
If you have any other questions, please contact us or check out Our Slack Community.