Welcome! Log In Create A New Profile

Advanced

Redirect everything to HTTPS except one URL

Posted by nicolasm 
Redirect everything to HTTPS except one URL
September 22, 2016 11:06AM
Hi,

I have an ecommerce website where I redirect everything to HTTPS, but there is a payment method that can't POST to https, so transactions status never change automatically.
I need to exclude the return URL of this payment method from HTTPS and receive on HTTP.

So far what I did:

(port 80)

location / { return 301 https://$host$request_uri;
}
location /wc-api/ {}

##########

(port 443)

location / {
try_files $uri $uri/ /index.php?$args;
}

location /wc-api/~* { return 301 http://$host$request_uri; }

###########

Return URL is https://mystore.com/wc-api/WC_PagSeguro_Gateway/

Everything works fine without SSL,

Thanks in advance

Nicolas
Re: Redirect everything to HTTPS except one URL
October 12, 2016 09:12AM
Nobody?
Re: Redirect everything to HTTPS except one URL
October 12, 2016 03:38PM
map $request_uri $requri {
default 1;
/wc-api/ 0;
}

server {
if ($requri) { return 301 https://$host$request_uri; }
location /wc-api/ { ... }

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 279
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready