G
G
Galdar Turin2020-09-01 17:05:53
Nginx
Galdar Turin, 2020-09-01 17:05:53

How to write a regular expression with domain variation?

Good evening.
You need to specify allowed domains where only login https://*.domain.ru will change

add_header 'Access-Control-Allow-Origin' 'https://login.domain.ru';


This option is not entirely suitable, as it requires placement in location. And you need to register outside all locations add_header 'Access-Control-Allow-Origin' ''
if ($http_origin ~* "^https?://[^/]+\.domain\.ru$" ) {
        add_header Access-Control-Allow-Origin $http_origin;
      }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question