Answer the question
In order to leave comments, you need to log in
How to redirect a directory to an identical subdomain directory while keeping post parameters and http request headers?
Hello.
There is a directory with request processing controllers /api/controllers/v1/*.php on the main domain.
How to make a redirect to a subdomain with exactly the same directory in nginx or htaccess while preserving the transmitted http headers and POST parameters?
Answer the question
In order to leave comments, you need to log in
location /api/controllers/v1 {
rewrite ^/api/controllers/v1(.*)$ https://sub.domain.com/$1 redirect;
}
It's just a redirect. Standard 301/302 will change the request to GET. There are 307/308, but they only guarantee to keep the POST and the request body, not the headers.
Perhaps you need a reverse proxy:
https://nginx.org/ru/docs/http/ngx_http_proxy_modu...
https://httpd.apache.org/docs/2.4/mod/mod_proxy.ht...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question