เวลามี JasperServer อยู่หลัง nginx proxy เวลาเปิดเว็บมันจะวน loop refresh ตัวเองไม่เลิก และดูใน cataline.out จะพบอะไรทำนอง
2017-06-09 03:25:17,409 ERROR CsrfGuard,http-nio-8082-exec-9:44 – potential cross-site request forgery (CSRF) attack thwarted (user:, ip:127.0.0.1, method:POST, uri:/jasperserver/flow.html, error:required token is missing from the request)
วิธีแก้คือ
1. ให้เติมใน nginx config
allow undescores in headers on your proxy
–nginx—
server {
…
underscores_in_headers on;}
2. apache-tomcat/conf/server.xml
เติม scheme=”https” proxyPort=”443″ ต่อท้ายในส่วน Connector
<Connector port="8888" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" scheme="https" proxyName="” proxyPort=”443″/>
ในเว็บด้านล่างบอกให้แก้ apache-tomcat/webapps/jasperserver/WEB-INF/classes/esapi/security-config.properties ตามด้านล่าง แต่เหมือนไม่ต้องทำก็ได้
security.validation.csrf.on=false
อีกแนวทางหนึ่งที่เหมือนจะได้คือแก้
WEB-INF/csrf/jrs.csrfguard.properties> org.owasp.csrfguard.Enabled = false