Answer the question
In order to leave comments, you need to log in
Why do HTTP Headers disappear when nginx redirects?
There is a controller and a bunch of clients with sensors. All clients connect to the controller at the old-site.ru
address. Sensors
began to arrive that connect to the controller at the new address new-site.ru , and no one is going to change the controller address yet, because don't know how.
The idea immediately came to mind to send new sensors to the server with nginx, where to organize a redirect from new-site.ru to old-site.ru . It seems nothing complicated, but there were problems.
The presence of http headers is important for the controller:
x-citron-mac : aa:33:99:ff:11:dd
Host : old-site.ru
In the absence of these headers or inconsistency, the sensor displays in its console:
[NETWORK] >> Error: void QtvDataStorageLoaderPrivate::_q_networkReplyFinished() parsing error in "http://new-site.ru/auth?mac=aa:33:99:ff:11:dd&Ver=334.15&ip=192.168.10.33" : "Start-end tags mismatch"
server {
listen 192.168.1.3:80;
server_name new-site.ru;
#rewrite ^/(.*)$ http://old-site.ru/$1 permanent;
#rewrite ^/(.*)$ http://old-site.ru$1 permanent;
#return 302 http://old-site.ru$request_uri;
#return 301 $scheme://old-site.ru$request_uri;
return 301 http://old-site.ru$/request_uri;
#rewrite ^ $scheme://old-site.ru.net;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question