In nginx.conf file, is it possible to rewrite to HTTP or HTTPS based on whether the current connection is secured or not?
Some pseudocode of what I want to do.
location ^~ /test_api {
if (secured connection)
rewrite "/test_api" https://www.somedomain.com/test_api break;
else
rewrite "/test_api" http://www.somedomain.com/test_api break;
}
Thanks.