I have an nginx
location block that should be delegated to uwsgi
backend and provide http
--> https
redirection, so it goes as follows:
location ~ ^/(api/v1) {
if ($http_x_forwarded_proto != 'https') {
rewrite ^ https://$host$request_uri? permanent;
}
access_log my-access.log;
error_log my-error.log;
include uwsgi_params;
uwsgi_read_timeout 300;
uwsgi_send_timeout 300;
uwsgi_param ..;
uwsgi_param ..;
etc ...
}
What I want, is for a specific endpoint not to provide https
redirection, so I am forced to do the following:
location = /api/v1/my/more/specific/endpoint {
access_log my-access.log;
error_log my-error.log;
include uwsgi_params;
uwsgi_read_timeout 300;
uwsgi_send_timeout 300;
uwsgi_param ..;
uwsgi_param ..;
etc ...
}
}
Is there a way nginx
allows to avoid the above duplication of uwsgi
parameters definition?