Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


HTTPS everything exclude one route
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

HTTPS everything exclude one route

I'm using Laravel in my project requiring HTTPS. The thing that I'm trying to solve is that I would need to access the following addresses without HTTPS, only in HTTP: domain.com/cron/[whatever]. My current htaccess file looks like this:

http://pastebin.com/nEL2yaGm

Comments

  • tommytommy Member

    add

    RewriteCond %{REQUEST_URI} !cron [NC]
    

    under

    RewriteEngine On
    

    btw why you need to access these cron via http? just curious

  • @tommy said:
    add

    Not work :(

    .htaccess
    http://pastebin.com/kQskGEGa

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    
    301 Moved Permanently
    
    Moved Permanently
    The document has moved here.
    

    Company use bad provider, provider support only http get CURL, but i need https for HTML Geolocation API.

  • Worst case scenario, put nginx as a reverse proxy. Configure nginx to serve http and fetch the address from the original server.

  • @deadbeef said:
    Worst case scenario, put nginx as a reverse proxy. Configure nginx to serve http and fetch the address from the original server.

    I make subdomain, and php get https url with file_get_contents.
    Its Terrible

  • Try something like this:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !cron [NC]
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
  • @RenegadeNetworks said:
    Try something like this:

    > RewriteEngine On
    > RewriteCond %{HTTPS} off
    > RewriteCond %{REQUEST_URI} !cron [NC]
    > RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    > 

    Not work.

    Redirect https://doamin.com/index.php

  • Does it work if you try something like this? (you already have the 2nd and 4th lines)

    #Force HTTPS except on /cron
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteCond %{REQUEST_URI} !^/(cron)
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
    
    #Force HTTP on /cron
    RewriteCond %{HTTPS} =on
    RewriteCond %{REQUEST_URI} ^/(cron)
    RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
Sign In or Register to comment.