Ich habe ein Formular, das von JavaScript ausgefüllt und übermittelt wird. Das Formular wird von Laravel Form Builder erstellt. Hier ist der Code für das Formular:Laravel 5 Formular Buchung gibt 403 Fehler
{!!Form::open(['url' => URL::to('billing/payments', array(), true), 'id' => 'frmRebill'])!!}
{!!Form::hidden('plan', '', ['id' => 'plan'])!!}
{!!Form::hidden('annual', '', ['id' => 'annual'])!!}
{!!Form::close()!!}
Wenn Form von http://server.com/billing
zugegriffen wird und eingereicht https://server.com/billing/payment
oder http://server.com/billing/payment
, es funktioniert gut.
Aber wenn Formular von https://server.com/billing
zugegriffen wird und an https://server.com/billing/payment
gesendet wird, gibt es den Fehler 403.
Ich benutze Nginx. Hier ist die Nginx virtuelle Host-Datei:
server {
listen 80;
server_name server.com
charset utf-8;
sendfile off;
client_max_body_size 10m;
index index.php;
error_log /var/log/nginx/error.log debug;
access_log /var/log/nginx/access.log;
root /var/www/server/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/ {
error_log /var/log/nginx/mkj-error.log debug;
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)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
set $php_root /var/www/s/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;
}
}
Hinweis: Die csrf Token ist auch gleiche, die durch die Form und gespeichert in der Sitzung. Kann jemand bitte herausfinden, was das Problem ist und was ist die Lösung?
I amazon Load Balancer bin mit den Anfragen auf https nimmt und leitet es auf http interner VPC. – MKJ