Answer the question
In order to leave comments, you need to log in
How to make it possible to access api from one or more ip addresses in cors laravel?
The point is the following. There is a front for view and a backend for laravel. How to make the backend allow access to itself only from one (or several) ip? There is an opinion that this can be done through cors, but how, you really can’t google it.
Answer the question
In order to leave comments, you need to log in
It seems to me that the easiest way is through your Middleware
. You create a new one, there you somehow specify (take from the database or from the settings, just hardcode) a list of white ip, in the handle method $request is passed from there you can take the ip address. If it is not on your whitelist, just throw an exception, do a redirect, or somehow interrupt further execution.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question