Reputation: 19352
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?
Upvotes: 3
Views: 1717
Reputation: 11553
2 options:
server
context and must affect all locations our of the location
block to the server
blockIncludes another file, or files matching the specified mask, into configuration. Included files should consist of syntactically correct directives and blocks.
Upvotes: 4