L
L
levchick2016-11-16 15:08:22
Nginx
levchick, 2016-11-16 15:08:22

How to check response code from redirect url when redirecting in nginx?

Good afternoon,
There are two domains domain.com and domain.org, at the moment all requests are redirected from com to org with the corresponding uri. Is it possible to check the response code from .org with such a uri before redirecting and if it is not 200, just return it without any redirects? It must be done using the nginx server. Thanks for answers.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2016-11-16
@miraage

As far as I know, this cannot be done with standard directives.
However, you can write a few lines in Lua - then everything will be wonderful.

E
Eugene, 2016-11-16
@Nc_Soft

nginx.org/ru/docs/http/ngx_http_upstream_module.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question