Fortinet black logo

Administration Guide

FAQ

FAQ

What’s the order of multiple scripts matching?

When multiple scripts are selected in one server policy, the system will load scripts one by one. If there are multiple same events defined in the scripts, the event running order is the same as the loading order.

How to troubleshoot Scripting issues?

If you find your customized scripting does not work as expected, follow the steps below for troubleshooting:

  1. Ensure diagnose debug to check if the output matches the events and actions defined in the selected scripts:

    # diagnose debug proxy scripting-core 7 #scripting initiating and loading information

    # diagnose debug proxy scripting-user 7 #scripting user debug logs

    # diagnose debug timestamp enable

    # diagnose debug enable

    For example, if the predefined script HTTP_GET_COMMANDS is selected in a server-policy, then below logs will be printed HTTP requests hit the policy. You can also add extra debug print with debug() or other built-in functions to diagnose the problem you encounter.

    <18: 7:39>[script-core]: flua init session ctx 0x7fdc0b0fc000, core 0x7fdc29008200

    <18: 7:39>[script-core]: FLUA init http substream ctx 0x7fdc2e768680, session ctx 0x7fdc0b0fc000!

    <18: 7:39>[script-user]: ============= Dump HTTP request header =============

    <18: 7:39>[script-user]: host: 10.0.10.191, path: /new, url: /new, method: GET, version: HTTP/1.1

    <18: 7:39>[script-user]: HEADER: Host[1]: 10.0.10.191

    <18: 7:39>[script-user]: HEADER: User-Agent[1]: curl/7.83.1

    <18: 7:39>[script-user]: HEADER: Accept[1]: */*

    <18: 7:39>[script-user]: ========== Dump HTTP request header done ===========

    <18: 7:39>[script-user]: ============= Dump HTTP response header =============

    <18: 7:39>[script-user]: status code: 404 reason: Not Found

    <18: 7:39>[script-user]: HEADER: Content-Length[1]: 201

    <18: 7:39>[script-user]: HEADER: Date[1]: Thu, 20 Oct 2022 01:01:45 GMT

    <18: 7:39>[script-user]: HEADER: Server[1]: Apache/2.4.38 (Win64) OpenSSL/1.1.1b PHP/7.0.5 mod_jk/1.2.42

    <18: 7:39>[script-user]: HEADER: Content-Type[1]: text/html; charset=iso-8859-1

    <18: 7:39>[script-user]: HEADER: return_header[1]: HTTP/1.1 404 Not Found

    <18: 7:39>[script-user]: ========== Dump HTTP response header done ===========

    <18: 7:39>[script-core]: FLUA exit ctx 0x7fdc2e768680, core 0x7fdc29008200

    <18: 7:39>[script-core]: FLUA exit ctx 0x7fdc0b0fc000, core 0x7fdc29008200

  2. Collect your script, diagnose debug logs and the FortiWeb configuration file, send them to support for further analysis if you fail to find the cause.

FAQ

What’s the order of multiple scripts matching?

When multiple scripts are selected in one server policy, the system will load scripts one by one. If there are multiple same events defined in the scripts, the event running order is the same as the loading order.

How to troubleshoot Scripting issues?

If you find your customized scripting does not work as expected, follow the steps below for troubleshooting:

  1. Ensure diagnose debug to check if the output matches the events and actions defined in the selected scripts:

    # diagnose debug proxy scripting-core 7 #scripting initiating and loading information

    # diagnose debug proxy scripting-user 7 #scripting user debug logs

    # diagnose debug timestamp enable

    # diagnose debug enable

    For example, if the predefined script HTTP_GET_COMMANDS is selected in a server-policy, then below logs will be printed HTTP requests hit the policy. You can also add extra debug print with debug() or other built-in functions to diagnose the problem you encounter.

    <18: 7:39>[script-core]: flua init session ctx 0x7fdc0b0fc000, core 0x7fdc29008200

    <18: 7:39>[script-core]: FLUA init http substream ctx 0x7fdc2e768680, session ctx 0x7fdc0b0fc000!

    <18: 7:39>[script-user]: ============= Dump HTTP request header =============

    <18: 7:39>[script-user]: host: 10.0.10.191, path: /new, url: /new, method: GET, version: HTTP/1.1

    <18: 7:39>[script-user]: HEADER: Host[1]: 10.0.10.191

    <18: 7:39>[script-user]: HEADER: User-Agent[1]: curl/7.83.1

    <18: 7:39>[script-user]: HEADER: Accept[1]: */*

    <18: 7:39>[script-user]: ========== Dump HTTP request header done ===========

    <18: 7:39>[script-user]: ============= Dump HTTP response header =============

    <18: 7:39>[script-user]: status code: 404 reason: Not Found

    <18: 7:39>[script-user]: HEADER: Content-Length[1]: 201

    <18: 7:39>[script-user]: HEADER: Date[1]: Thu, 20 Oct 2022 01:01:45 GMT

    <18: 7:39>[script-user]: HEADER: Server[1]: Apache/2.4.38 (Win64) OpenSSL/1.1.1b PHP/7.0.5 mod_jk/1.2.42

    <18: 7:39>[script-user]: HEADER: Content-Type[1]: text/html; charset=iso-8859-1

    <18: 7:39>[script-user]: HEADER: return_header[1]: HTTP/1.1 404 Not Found

    <18: 7:39>[script-user]: ========== Dump HTTP response header done ===========

    <18: 7:39>[script-core]: FLUA exit ctx 0x7fdc2e768680, core 0x7fdc29008200

    <18: 7:39>[script-core]: FLUA exit ctx 0x7fdc0b0fc000, core 0x7fdc29008200

  2. Collect your script, diagnose debug logs and the FortiWeb configuration file, send them to support for further analysis if you fail to find the cause.