mercredi 30 mars 2016

Redirect with Laravel 5 helper Raising 403 Error

I have a project which is running fine on 'http', we decided to use https and every thing was going fine and suddenly noticed the problem that when we submit a form to a route it gives 403 Forbidden error. The form uses Laravel FormBuilder class and I used secure=true to get the secure url to submit the form.

I'm using nginx and apache, both have the same problem.

Here is my nginx file:

server {
    listen 80;
    server_name servername
    charset utf-8;
    sendfile off;
    client_max_body_size 10m;
    index index.php;
    root /var/www/servername/public;

    location /ping.html {
            return 200 'pong';
    }

location ~ ^/billing/(.+(?:css|js|woff|woff2|ttf))$ {
            alias /var/www/billing/public/$1;
            access_log off;
    }

#billing code in laravel5
location /billing/ {
    alias /var/www/billing/public;
    ## Check for file existing and if there, stop ##
    if (-f $request_filename) {
            break;
    }

    ## Check for file existing and if there, stop ##
    if (-d $request_filename) {
            break;
    }
    index index.php;
    try_files $uri $uri/ @billing;
}
location @billing {
rewrite /billing/(.*)$ /billing/index.php?/$1 last;
}

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    set $php_root /var/www/servername/public;
    if ($request_uri ~ /billing) {
        set $php_root /var/www/billing/public;
    }
    fastcgi_param PATH_TRANSLATED $php_root/index.php;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    fastcgi_param REMOTE_ADDR $http_x_real_ip;
    include fastcgi_params;
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;
    fastcgi_read_timeout 120;
}

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


location ~ /\.ht {
deny all;
}
}

Any help please?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire