T
T
Tyoma Makeev2015-12-13 17:02:56
Nginx
Tyoma Makeev, 2015-12-13 17:02:56

Rewrites on CDN in Nginx, or in advance in html?

I saw on the Internet Sysoev's answer to someone's question about rewriting on CDN

location ~* ^.+.(jpe?g|gif|css|png|js|ico)$ {
rewrite ^ http://http.cdnlayer.com/contentfolder$request_uri?
permanent;
access_log off;
}

The question arose: how good is this method in general? How much worse / better is this than replacing links in the html itself, which is given to the client?
Do I understand correctly that everything here in real life will also be tied to redirect caching, that is, it will not work to change the CDN painlessly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zooks, 2015-12-13
@murmuringvoices

Про кэширование не скажу, но редиректы - зло. Медленней загружается страница. Поисковики не любят редиректы - это лишь временная мера при изменении путей.
Получается, нужно оставить редирект для уже проиндексированных изображений. А в самом HTML указывать новые пути на CDN.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question