盘点前后端开发中的那些"BUG"

跨域问题

  1. 即使Web容器或nginx代理中设置了Header: Access-Control-Allow-Origin: *,ajax还是被浏览器拦截,甚至无法抵达后端!
    先来 https://www.cnblogs.com/develon/p/12788604.html 学习一下浏览器同源策略、CORS:跨域资源共享。

上传问题

  1. 上传时浏览器POST请求报413 – Request Entity Too Large Error and Solution
    首先需要肯定的是413状态不是浏览器在"无中生有",它很可能是nginx代理在自作主张。
    可以在 http or server or location 上下文中设置指令:
client_max_body_size    800M;

MySQL 时区问题

查看MySQL时区设置:

show variables like "%time_zone%";
mysql> show variables like "%time_zone%";                                                                                                              
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | CST    |
| time_zone        | SYSTEM |
+------------------+--------+

CST的话,插入应该是没问题的,我们在JDBC URL中设置serverTimezone为GMT%2B8(GMT+8的转义)或者Asia/Shanghai即可:

{
  "Hibernate不能使用的参数": "useServerPrepStmts=true",
  "db_url": "jdbc:mysql://服务器IP:3306/dev?useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&characterEncoding=utf8&cachePrepStmts=true&autoReconnect=true",
  "db_user": "root",
  "db_password": "kasumi"
}

posted @ 2020-04-30 15:26  develon  阅读(272)  评论(0编辑  收藏  举报