Introduction:
- I want to create a http (no secure) public url to process Redsys (payment gateway) callbacks.
- Why http? Because I have Cloudflare and they don't like their shared certificates -> handshake error
- Why not to upload my own certificate (single IP) to Cloudflare? Because I have to pay a monthly fee, and so far is a small project.
- Workaround? Create a http url and process the callbacks there
Situation:
- I'm using Laravel and I've created a route to my controller "/tpv"
- I've all the Nginx configuration ready, listening to 80
Problem:
- I've got too many redirects, because location /tpv calls Laravel (index.php/tpv) which is affected by location / {redirect to https}
Question:
- Any creative idea to solve this?
Idea:
- Create an external php script in a folder called tpv and from there call the Laravel controller, but no clue how to do this or if it's feasible.
- Delete the Ngnix conf and manage the redirects directly with Laravel as per post Laravel 5 - redirect to HTTPS
Before changing to Nginx I was using Rewrites, it might be the solution:
RewriteCond %{SERVER_PORT} 80
RewriteCond %{THE_REQUEST} !/tpv [NC]
Ngnix conf for reference:
server {
listen 80;
listen [::]:80;
server_name .example.com;
root /home/forge/example.com/public;
location /tpv {
return 301 http://example.com/index.php/tpv;
}
location /index.php/tpv {
return 301 http://example.com/index.php/tpv;
}
location / { # the default location redirects to https
return 301 https://$host$request_uri;
}
}