Craig Edmonds
Craig Edmonds

Reputation: 2262

PHP Detect if incoming request is using https

I have made a sweet api but I want to only accept requests to ssl version so if users submit their $_REQUEST to http://example.com then I would like to detect that and show them a warning.

Upvotes: 1

Views: 520

Answers (1)

Polak
Polak

Reputation: 1543

If you're using apache with mod_ssl, check the directive called SSLRequireSSL And for nginx should be something similar here. This is used to allow/deny access to your files/scripts depending on the port which the request comes from.

Upvotes: 1

Related Questions