A
A
Alexey2018-03-11 19:58:48
Browsers
Alexey, 2018-03-11 19:58:48

How to properly filter GET requests made from the browser?

There is a small REST interface that reconfigures the service based on GET / POST requests. So far, I just started doing it, but I ran into a problem due to the peculiarities of modern browsers. The request from the browser is executed 2 times, which breaks the logic of work. Well, since this is the easiest and fastest option to update the configuration, the majority will naturally use it. Disabled user-agent on the web server according to the pattern (mozilla|chrome|safari).
Will this be enough?
Are there other options for restricting requests from browsers?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2018-03-11
@yarkov

The request from the browser is executed 2 times

If I remember correctly, this is CORS and is very easy to set up. You send 204 to the OPTIONS request from the server and the next request reaches the right place.
Instructions for Nginx: https://enable-cors.org/server_nginx.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question