Good day,
I want to use nginx to fix some php errors in legacy code) So this is gone be strange one.
I have test1.mydomain.com and test2.mydomain.com and sometimes php back-end routes request to test2 to test1, so i want using nginx place a permanent rewrite in config of test2.mydomain.com so that any url`s with test1 going through it will be changed to test2.
i tried to do simple rewrite, as
location / {
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_pass http://some-ip;
real_ip_header X-Real-IP;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 800s;
proxy_send_timeout 800s;
proxy_read_timeout 800s;
send_timeout 800s;
proxy_request_buffering off;
proxy_buffering off;
rewrite ^test1.mydomain.com/(.*)$ https://test2.mydomain.com/$1 break;
}
but it didn`t work.
New contributor
Abram Malkin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.