Php Laravel 5表格过账给出403错误
我有一个由JavaScript填充和提交的表单。该表单由Laravel form Builder生成。以下是表格的代码:Php Laravel 5表格过账给出403错误,php,post,nginx,laravel-5,http-status-code-403,Php,Post,Nginx,Laravel 5,Http Status Code 403,我有一个由JavaScript填充和提交的表单。该表单由Laravel form Builder生成。以下是表格的代码: {!!Form::open(['url' => URL::to('billing/payments', array(), true ), 'id' => 'frmRebill'])!!} {!!Form::hidden('plan', '', ['id' => 'plan'])!!} {!!Form::hidden('annual', '',
{!!Form::open(['url' => URL::to('billing/payments', array(), true ), 'id' => 'frmRebill'])!!}
{!!Form::hidden('plan', '', ['id' => 'plan'])!!}
{!!Form::hidden('annual', '', ['id' => 'annual'])!!}
{!!Form::close()!!}
如果从http://server.com/billing
并提交至https://server.com/billing/payment
或http://server.com/billing/payment
,工作正常
但当从https://server.com/billing
并提交至https://server.com/billing/payment
它给出了403错误
我正在使用Nginx。以下是Nginx虚拟主机文件:
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;
}
}
注意:csrf令牌也是由表单生成并保存在会话中的相同令牌。
有人能找出问题所在和解决方案吗?您需要配置HTTPS服务器。配置文件仅侦听http请求
server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate www.example.com.crt;
ssl_certificate_key www.example.com.key;
...
}
这里有一个关于如何配置HTTPS服务器的链接。配置文件仅侦听http请求
server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate www.example.com.crt;
ssl_certificate_key www.example.com.key;
...
}
这里有一个关于如何的链接,我正在使用amazon负载平衡器,它通过https接收请求并将其重定向到内部VPC的http。我正在使用amazon负载平衡器,它通过https接收请求并将其重定向到内部VPC的http。