I want that certain pages to be available on https but not on http. I have a Code Igniter framework there.
Here is the code from nginx conf:
server {
listen 80;
......
#enforce https
if ($request_uri ~ "^(winkelmandje|(index.php/)?winkelmandje|(index.php/)?history|(index.php/)?mobile/winkelmandje|(index.php/)?winkelmandje/voegtoe)"){
rewrite ^/(.*)$ https://$http_host/$1 permanent;
}
....
}
server {
listen 443;
ssl on;
....
#enforce http
if ($request_uri ~ "^(!(index.php/)?winkelmandje|!(index.php/)!mobile/winkelmandje|!(index.php/)?history|assets/|!lib_desktop/|!lib_mobile/|!images/|!widget/|!(index.php/)?winkelmandje/voegtoe)"){
rewrite ^/(.*)$ http://$http_host/$1 permanent;
}
.....
}
if i go to my domain/winkelmandje (this page is the cart) on http i do not get redirected to https.
Another example is if i access the domain index on https i do not get redirected on http