0

In my Laravel app i have a POST endpoint in which Arduino sends some data. I installed SSL and tried communication again but with no result (redirect). I want to exclude only this specific endpoint from https. I tried different approaches and code that found with no result.

e.g. Route endpoint: /api/measures

.htaccess file:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
user2094178
  • 9,204
  • 10
  • 41
  • 70
billyVal
  • 33
  • 8
  • I'm a nginx type of person myself, but from what i know you need to allow both http and https traffic and redirect http to https on all links except that one. – Indra Jan 24 '19 at 13:44

1 Answers1

0

Thankfully i found a solution following a different way than changing .htaccess. With the help of Laravel i applied a middleware that redirects all web and api requests to secure requests and excluded the only endpoint that takes the request from Arduino client (can't handle ssl).

Answer that helped me Laravel 5 - redirect to HTTPS

billyVal
  • 33
  • 8