Nginx reverse proxy with Access-Control-Allow-Origin

I want to use fonts from our resource server. Firefox and some other browsers should configure Access-Control-Allow-Origin correctly, and I cannot get this to work.

We work in reverse proxy. I added this to our web server definition for resource server

location ~* \.(eot|ttf|woff)$ {
  add_header Access-Control-Allow-Origin *;
}

I also tried this

location ~* \.(eot|ttf|woff)$ {
   proxy_set_header Access-Control-Allow-Origin *;
}

In both cases, the woff and ttf files do not receive the expected header in the response. I could not find any good links to make this work. Any suggestions?

+4
source share

Source: https://habr.com/ru/post/1525323/


All Articles