การแก้ปัญหาข้อผิดพลาดในการทำให้นโยบายการป้องกันนิพจน์ทั่วไปใช้งานได้

คุณกำลังดูเอกสารประกอบของ Apigee Edge
ไปที่เอกสารประกอบของ Apigee X
ข้อมูล

InvalidRegularExpression

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Deploying Revision revision_number to environment
RegularExpressionProtection policy_name: Invalid Regular Expression com.apigee.steps.regexprotection.RegularExpressionProtectionBean$RegexPattern@f4ecb23, Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Deploying Revision 1 to test
RegularExpressionProtection Regular-Expression-Protection-1: Invalid Regular Expression com.apigee.steps.regexprotection.RegularExpressionProtectionBean$RegexPattern@f4ecb23, Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาดของนิพจน์ทั่วไปไม่ถูกต้อง

สาเหตุ

หากนิพจน์ทั่วไปในองค์ประกอบ <Pattern> ของนโยบาย regularExpressionProtection ไม่ถูกต้อง จะทำให้ใช้งานพร็อกซี API ไม่สำเร็จ

การวินิจฉัย

  1. ระบุชื่อของนโยบาย regularExpressionProtection จากข้อความแสดงข้อผิดพลาด ตัวอย่างเช่น ชื่อนโยบาย regularExpressionProtection คือ Regular-Expression-Protection-1: ในข้อผิดพลาดต่อไปนี้

    Error Deploying Revision 1 to test
    RegularExpressionProtection Regular-Expression-Protection-1: Invalid Regular Expression com.apigee.steps.regexprotection.RegularExpressionProtectionBean$RegexPattern@f4ecb23, Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
    
  2. ตรวจสอบองค์ประกอบ <Pattern> ทั้งหมดใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปที่ไม่ผ่านการตรวจสอบ ตรวจสอบว่าองค์ประกอบ <Pattern> มีนิพจน์ทั่วไปที่ไม่ถูกต้องหรือไม่ หากองค์ประกอบ <Pattern> ใดมีนิพจน์ทั่วไปที่ไม่ถูกต้อง นั่นเป็นสาเหตุของข้อผิดพลาด

    ตัวอย่างเช่น นโยบายต่อไปนี้ระบุค่า Pattern> ของ foo){2} ซึ่งถือว่าเป็นนิพจน์ทั่วไปที่ไม่ถูกต้อง

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
            <DisplayName>Regular Expression Protection-1</DisplayName>
            <Properties/>
            <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
            <URIPath>
                <Pattern>foo){2}</Pattern>
            </URIPath>
            <Source>request</Source>
        </RegularExpressionProtection>
    

    ในตัวอย่างข้างต้น นิพจน์ทั่วไปที่ระบุใน <Pattern> ไม่มีวงเล็บเปิด ดังนั้น จึงถือเป็นนิพจน์ทั่วไปที่ไม่ถูกต้อง ดังนั้นการทำให้พร็อกซี API ใช้งานได้จึงล้มเหลว

ความละเอียด

ตรวจสอบว่าองค์ประกอบ <Pattern> แต่ละรายการใน นโยบาย regularExpressionProtection มีนิพจน์ทั่วไปที่ถูกต้อง คุณสามารถค้นหาเครื่องมือนิพจน์ทั่วไปออนไลน์หรือออฟไลน์อื่นๆ เพื่อแก้ไขข้อบกพร่องของนิพจน์ทั่วไป หากต้องการแก้ไขตัวอย่างนโยบายการป้องกันนิพจน์ทั่วไปที่แสดงด้านบน ให้เพิ่มวงเล็บที่ขาดหายไป ดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
        <DisplayName>Regular Expression Protection-1</DisplayName>
        <Properties/>
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
        <URIPath>
            <Pattern>(foo){2}</Pattern>
        </URIPath>
        <Source>request</Source>
    </RegularExpressionProtection>

XPathCompilationFailed

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Deploying Revision revision_number to environment
RegularExpressionProtection policy_name: Failed to compile xpath xpath_expression. Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Deploying Revision 1 to test
RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile xpath /notapigee:foo/notapigee:bar. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาด XPathCompilationFailed

สาเหตุ

หากคำนำหน้าหรือค่าที่ใช้ในองค์ประกอบ <XPath> ไม่ได้เป็นส่วนหนึ่งของเนมสเปซที่ประกาศในนโยบาย regularExpressionProtection การทำให้พร็อกซี API ใช้งานได้จะไม่สำเร็จ

คุณสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับเนมสเปซ, XPath และคำนำหน้าใน เนมสเปซ XML และผลกระทบที่มีต่อ XPath และ XSLT

การวินิจฉัย

  1. ระบุชื่อของนโยบาย regularExpressionProtection ที่เกิดข้อผิดพลาดและนิพจน์ XPath ที่ใช้ คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด

    ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ Regular-Expression-Protection-1 และนิพจน์ XPath คือ /notapigee:foo/notapigee:bar:

    Error Deploying Revision 1 to test
    RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile xpath /notapigee:foo/notapigee:bar. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
    
  2. ใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปไม่สำเร็จ ให้ตรวจสอบว่า XPath ที่ตั้งค่าไว้ในองค์ประกอบ Expression ตรงกับ XPath ที่ระบุในข้อความแสดงข้อผิดพลาด (ขั้นตอนที่ 1 ด้านบน)

    ตัวอย่างเช่น นโยบายต่อไปนี้ระบุ XPath เป็น /notapigee:foo/notapigee:bar ซึ่งตรงกับข้อความแสดงข้อผิดพลาด

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
        <DisplayName>Regular Expression Protection-1</DisplayName>
        <Properties/>
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
        <Source>request</Source>
         <XMLPayload>
             <Namespaces>
                 <Namespace prefix="apigee">http://www.apigee.com</Namespace>
             </Namespaces>
             <XPath>
                 <Expression>/notapigee:foo/notapigee:bar</Expression>
                 <Type>nodeset</Type>
                 <Pattern>pattern</Pattern>
                 <Pattern>pattern2</Pattern>
             </XPath>
         </XMLPayload>
    </RegularExpressionProtection>
    
  3. ตรวจสอบองค์ประกอบ <Namespaces> และ <Expression> ในนโยบาย regularExpressionProtection หาก <Expression> ที่เจาะจงซึ่งระบุไว้ในข้อความแสดงข้อผิดพลาดใช้คำนำหน้าหรือค่าที่ไม่ได้เป็นส่วนหนึ่งของเนมสเปซที่ประกาศในนโยบาย RegularExpressionProtection

    โปรดสังเกตว่า <XPath> แต่ละรายการใช้คำนำหน้า notapigee ในตัวอย่างนโยบาย regularExpressionProtection

    <Expression>/notapigee:foo/notapigee:bar</Expression>

    อย่างไรก็ตาม ไม่ได้กำหนดคำนำหน้า notapigee ในองค์ประกอบ <Namespace> ใดๆ ดังนั้นการรวม <XPath> จะล้มเหลวทำให้การทำให้ใช้งานได้ล้มเหลว

ความละเอียด

ตรวจสอบว่าเนมสเปซทั้งหมดที่ใช้ในองค์ประกอบ <Expression> ภายใต้องค์ประกอบ <XPath> ได้รับการประกาศในนโยบาย regularExpressionProtection ในการแก้ไขปัญหาตัวอย่างข้างต้น คุณสามารถแทนที่คำนำหน้า notapigee เป็น apigee ซึ่งประกาศไว้ในเนมสเปซ:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
    <DisplayName>Regular Expression Protection-1</DisplayName>
    <Properties/>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <Source>request</Source>
     <XMLPayload>
         <Namespaces>
             <Namespace prefix="apigee">http://www.apigee.com</Namespace>
         </Namespaces>
         <XPath>
             <Expression>/apigee:foo/apigee:bar</Expression>
             <Type>nodeset</Type>
             <Pattern>pattern</Pattern>
             <Pattern>pattern2</Pattern>
         </XPath>
     </XMLPayload>
</RegularExpressionProtection>

CannotBeConvertedToNodeset

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Deploying Revision revision_number to environment
RegularExpressionProtection policy_name: Result of xpath xpath_expression cannot be converted to nodeset. Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Deploying Revision 1 to test
RegularExpressionProtection Regular-Expression-Protection-1: Result of xpath count(//apigee:foo) cannot be converted to nodeset. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาด CanBeConvertToNodeset

สาเหตุ

หากนโยบายนิพจน์ทั่วไปมีนิพจน์ <XPath> ที่องค์ประกอบ <Type> ได้รับการกำหนดเป็น nodeset แต่ไม่สามารถเปลี่ยนนิพจน์เป็นชุดโหนด การทำให้พร็อกซี API ใช้งานได้จะล้มเหลว

การวินิจฉัย

  1. ระบุนโยบาย regularExpressionProtection ที่เกิดข้อผิดพลาดและนิพจน์ XPath ที่แปลงเป็นชุดโหนดไม่ได้ คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด

    ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ Regular-Expression-Protection-1 และนิพจน์ XPath คือ count(//apigee:foo):

    Error Deploying Revision 1 to test
    RegularExpressionProtection Regular-Expression-Protection-1: Result of xpath count(//apigee:foo) cannot be converted to nodeset. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
    
  2. ใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปไม่สำเร็จ ให้ตรวจสอบว่า XPath ที่ตั้งค่าในองค์ประกอบ <Expression> ขององค์ประกอบ <XPath> ตรงกับ XPath ที่ระบุในข้อความแสดงข้อผิดพลาด (ขั้นตอนที่ 1 ด้านบน)

    ตัวอย่างเช่น นโยบายต่อไปนี้ระบุเป็น count(//apigee:foo) ซึ่งตรงกับข้อความแสดงข้อผิดพลาด

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
            <DisplayName>Regular Expression Protection-1</DisplayName>
            <Properties/>
            <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
            <Source>request</Source>
             <XMLPayload>
                 <Namespaces>
                     <Namespace prefix="apigee">http://www.apigee.com</Namespace>
                 </Namespaces>
                 <XPath>
                     <Expression>count(//apigee:foo)</Expression>
                     <Type>nodeset</Type>
                     <Pattern>pattern</Pattern>
                     <Pattern>pattern2</Pattern>
                 </XPath>
             </XMLPayload>
        </RegularExpressionProtection>
    
  3. ตรวจสอบค่าที่ตั้งไว้ในองค์ประกอบ <Type> ภายใต้องค์ประกอบ <XPath> หากองค์ประกอบ <Type> คือ nodeset นั่นเป็นสาเหตุของข้อผิดพลาด

    ในตัวอย่างนี้ นิพจน์ XPath คือ count() ซึ่งจะไม่แสดงโหนดอย่างน้อย 1 รายการ ดังนั้น การทำให้พร็อกซี API ใช้งานได้จึงล้มเหลว

ความละเอียด

หากตั้งค่าองค์ประกอบ <Type> เป็นชุดโหนด โปรดตรวจสอบว่าผลลัพธ์ขององค์ประกอบ <Expression> ที่ตั้งค่าไว้ใน <XPath> คืออย่างน้อย 1 โหนด หรือเปลี่ยนองค์ประกอบ <Type> เป็นค่าที่เหมาะสมมากขึ้นตามกรณีการใช้งานของคุณ

ในการแก้ไขตัวอย่างข้างต้น คุณเปลี่ยนองค์ประกอบ <Expression> ให้เป็นค่าอื่นที่สามารถแสดงโหนดได้ โดยทำดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
    <DisplayName>Regular Expression Protection-1</DisplayName>
    <Properties/>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <Source>request</Source>
     <XMLPayload>
         <Namespaces>
             <Namespace prefix="apigee">http://www.apigee.com</Namespace>
         </Namespaces>
         <XPath>
             <Expression>/apigee:foo/apigee:bar</Expression>
             <Type>nodeset</Type>
             <Pattern>pattern</Pattern>
             <Pattern>pattern2</Pattern>
         </XPath>
     </XMLPayload>
</RegularExpressionProtection>

JSONPathCompilationFailed

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Deploying Revision revision_number to environment
RegularExpressionProtection policy_name: Failed to compile jsonpath jsonpath_expression Context Revision:revision_number;APIProxy:RegexThreat;Organization:organization;Environment:environment.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Deploying Revision 1 to test
RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile jsonpath $.store.book[*.author. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาด JSONPathCompilationFailed

สาเหตุ

หากตั้งค่าองค์ประกอบ <Expression> ในส่วนองค์ประกอบ <JSONPath> ของนโยบายการป้องกันนิพจน์ทั่วไปเป็นนิพจน์ JSONPath ที่ไม่ถูกต้อง จะทำให้ใช้งานพร็อกซี API ไม่สำเร็จ

การวินิจฉัย

  1. ระบุชื่อนโยบาย regularExpressionProtection ที่เกิดข้อผิดพลาดและใช้นิพจน์ JSONPath ที่ไม่ถูกต้อง คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด

    ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ Regular-Expression-Protection-1 และนิพจน์ JSONPath คือ $.store.book[*.author:

    Error Deploying Revision 1 to test
    RegularExpressionProtection Regular-Expression-Protection-1: Failed to compile jsonpath $.store.book[*.author. Context Revision:1;APIProxy:RegexThreat;Organization:myorg;Environment:test.
    
  2. ใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปไม่สำเร็จ ให้ตรวจสอบว่า JSONPath ที่ตั้งค่าในองค์ประกอบ Expression ตรงกับ JSONPath ที่ระบุในข้อความแสดงข้อผิดพลาด (ขั้นตอนที่ 1 ด้านบน)

    ตัวอย่างเช่น นโยบายต่อไปนี้ระบุองค์ประกอบ Expression ภายใต้องค์ประกอบ <JSONPath> เป็น $.store.book[*.author ซึ่งตรงกับสิ่งที่อยู่ในข้อความแสดงข้อผิดพลาด

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
            <DisplayName>Regular Expression Protection-1</DisplayName>
            <Properties/>
            <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
            <Source>request</Source>
            <JSONPayload>
                 <JSONPath>
                     <Expression>$.store.book[*.author</Expression>
                     <Pattern>REGEX PATTERN</Pattern>
                     <Pattern>REGEX PATTERN</Pattern>
                 </JSONPath>
                </JSONPayload>
        </RegularExpressionProtection>
    
  3. ตรวจสอบองค์ประกอบ <Expression> ในส่วนองค์ประกอบ <JSONPath> ในนโยบาย หากไม่ตรงกับไวยากรณ์ JSONPath แสดงว่านี่เป็นสาเหตุของข้อผิดพลาด ในตัวอย่างข้างต้น ไม่มีวงเล็บเหลี่ยมปิด ซึ่งทำให้นิพจน์ไม่ถูกต้อง

    เนื่องจากนิพจน์เส้นทาง JSON ไม่ถูกต้อง ทำให้ใช้งานพร็อกซี API ไม่สำเร็จ

ความละเอียด

ตรวจสอบว่าค่าสำหรับองค์ประกอบ <Expression> ภายในองค์ประกอบ <JSONPath> ในนโยบายการป้องกันนิพจน์ทั่วไปเป็นนิพจน์ JSONPath ที่ถูกต้อง

หากต้องการแก้ไขตัวอย่างที่แสดงข้างต้น คุณสามารถเพิ่มวงเล็บเหลี่ยมปิดที่ขาดหายไปลงในค่าองค์ประกอบ <Expression> ดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
    <DisplayName>Regular Expression Protection-1</DisplayName>
    <Properties/>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <Source>request</Source>
    <JSONPayload>
         <JSONPath>
             <Expression>$.store.book[*].author</Expression>
             <Pattern>REGEX PATTERN</Pattern>
             <Pattern>REGEX PATTERN</Pattern>
         </JSONPath>
        </JSONPayload>
</RegularExpressionProtection>

NothingToEnforce

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
RegularExpressionProtection policy_name: at least one of URIPath, QueryParam, Header, FormParam, XMLPayload, JSONPayload is mandatory.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: at least one of URIPath, QueryParam, Header, FormParam, XMLPayload, JSONPayload is mandatory.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาด NothingToRestrict

สาเหตุ

หากนโยบาย regularExpressionProtection ไม่มีองค์ประกอบ <URIPath>, <QueryParam>, <Header>, <FormParam>, <XMLPayload> หรือ <JSONPayload> จะทำให้ใช้งานพร็อกซี API ไม่สำเร็จ

ตามที่ระบุไว้ในข้อความแสดงข้อผิดพลาด นโยบาย regularExpressionProtection ต้องมีองค์ประกอบอย่างน้อย 1 รายการรวมอยู่ในนโยบายด้วย ได้แก่ <URIPath>, <QueryParam>, <Header>, <FormParam>, <XMLPayload> หรือ <JSONPayload>

การวินิจฉัย

  1. ระบุชื่อของนโยบาย regularExpressionProtection ที่เกิดข้อผิดพลาด ดูได้ในข้อความแสดงข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ Regular-Expression-Protection-1:

    RegularExpressionProtection Regular-Expression-Protection-1: at least one of URIPath, QueryParam, Header, FormParam, XMLPayload, JSONPayload is mandatory.
    
  2. ตรวจสอบนโยบายการป้องกันนิพจน์ทั่วไปที่ล้มเหลว (ซึ่งระบุในขั้นตอนที่ 1 ด้านบน) หากนโยบายไม่มีองค์ประกอบอย่างใดอย่างหนึ่งต่อไปนี้ <URIPath>, <QueryParam>, <Header>, <FormParam>, <XMLPayload> หรือ <JSONPayload> สาเหตุของข้อผิดพลาดดังกล่าว

    ตัวอย่างเช่น นโยบายการป้องกันนิพจน์ทั่วไปต่อไปนี้ไม่มีองค์ประกอบที่ระบุไว้ข้างต้น

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
            <DisplayName>Regular Expression Protection-1</DisplayName>
            <Properties/>
            <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
            <Source>request</Source>
        </RegularExpressionProtection>
    

    การใช้งานพร็อกซี API ล้มเหลวเนื่องจากไม่มีองค์ประกอบที่จำเป็นในนโยบายการดึงข้อมูลตัวแปร

ความละเอียด

ตรวจสอบว่านโยบาย CommonExpressionProtection มีองค์ประกอบที่จำเป็นเหล่านี้อย่างน้อย 1 องค์ประกอบ ได้แก่ <URIPath>, <QueryParam>, <Header>, <FormParam>, <XMLPayload> หรือ <JSONPayload> เช่น

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
    <DisplayName>Regular Expression Protection-1</DisplayName>
    <Properties/>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <Source>request</Source>
    <JSONPayload>
        <JSONPath>
            <Expression>$.store.book[*].author</Expression>
            <Pattern>REGEX PATTERN</Pattern>
            <Pattern>REGEX PATTERN</Pattern>
        </JSONPath>
    </JSONPayload>
</RegularExpressionProtection>

NoPatternsToEnforce

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
RegularExpressionProtection policy_name: No patterns to enforce in payload_name.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: No patterns to enforce in XPath.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาดของ NoPatternsToนำผู้ใช้ออก

สาเหตุ

หากองค์ประกอบระดับบนสุด (<URIPath>, <QueryParam>, <Header>, <FormParam>, <XMLPayload> หรือ <JSONPayload>) ไม่มีองค์ประกอบ <Pattern> ที่กำหนดไว้ในนโยบาย regularExpressionProtection จะทำให้การทำให้พร็อกซี API ใช้งานได้ไม่สำเร็จ

การวินิจฉัย

  1. ระบุชื่อของนโยบาย regularExpressionProtection ที่เกิดข้อผิดพลาดและองค์ประกอบย่อยที่ไม่มีองค์ประกอบ <Pattern> คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด

    ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ Regular-Expression-Protection-1 และองค์ประกอบย่อยคือ XPath:

    RegularExpressionProtection Regular-Expression-Protection-1: No patterns to enforce in XPath.
    
  2. อ่านนโยบายการป้องกันนิพจน์ทั่วไปที่ล้มเหลว และยืนยันว่าองค์ประกอบย่อยที่ระบุในขั้นตอนที่ #1 ไม่มีองค์ประกอบ <Pattern> หากไม่มีองค์ประกอบ <Pattern> อยู่ภายใน นั่นเป็นสาเหตุของข้อผิดพลาด

    ตัวอย่างเช่น นโยบายต่อไปนี้ไม่มีองค์ประกอบ <Pattern> ภายใน <XPath>

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
          <DisplayName>Regular Expression Protection-1</DisplayName>
          <Properties/>
          <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
          <Source>request</Source>
          <XMLPayload>
            <Namespaces>
              <Namespace prefix="apigee">http://www.apigee.com</Namespace>
            </Namespaces>
            <XPath>
              <Expression>/apigee:Greeting/apigee:User</Expression>
              <Type>string</Type>
            </XPath>
          </XMLPayload>
        </RegularExpressionProtection>
    

    เนื่องจากองค์ประกอบ <XPath> ไม่มีองค์ประกอบ <Pattern> ทำให้ใช้งานพร็อกซี API ไม่สำเร็จ

ความละเอียด

ตรวจสอบว่าองค์ประกอบ <URIPath>, <QueryParam>, <Header>, <FormParam>, <XMLPayload> หรือ <JSONPayload> มีการระบุ <Pattern> อย่างน้อย 1 รายการ ดูข้อมูลเกี่ยวกับวิธีระบุองค์ประกอบอย่างถูกต้องในนโยบาย regularExpressionProtection

ในการแก้ไขตัวอย่างข้างต้น เราสามารถเพิ่มองค์ประกอบ <Pattern> ลงในองค์ประกอบ <XPath> ภายใต้ <XMLPayload> ดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
  <DisplayName>Regular Expression Protection-1</DisplayName>
  <Properties/>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
  <Source>request</Source>
  <XMLPayload>
    <Namespaces>
      <Namespace prefix="apigee">http://www.apigee.com</Namespace>
    </Namespaces>
    <XPath>
      <Expression>/apigee:Greeting/apigee:User</Expression>
      <Type>string</Type>
      <Pattern>REGEX PATTERN</Pattern>
    </XPath>
  </XMLPayload>
</RegularExpressionProtection>

NONEmptyPrefixMappedToEmptyURI

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
RegularExpressionProtection policy_name: Non-empty prefix prefix_name cannot be mapped to empty uri.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: Non-empty prefix apigee cannot be mapped to empty uri.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาด NONEmptyPrefixMappedToEmptyURI

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากนโยบาย regularExpressionProtection มีคำนำหน้าที่กำหนดไว้ในองค์ประกอบ <Namespace> ภายใต้องค์ประกอบ <XMLPayload> แต่ไม่ได้กำหนด URI

การวินิจฉัย

  1. ระบุนโยบาย regularExpressionProtection ที่เกิดข้อผิดพลาดและชื่อของคำนำหน้าที่ไม่ได้แมปกับ URI คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด

    ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ regular Expression Protection-1 และคำนำหน้าคือ Apigee

    RegularExpressionProtection Regular-Expression-Protection-1: Non-empty prefix apigee cannot be mapped to empty uri.
    
  2. ใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปไม่สำเร็จ ให้ตรวจสอบว่าชื่อของคำนำหน้าที่กำหนดไว้ในองค์ประกอบ <Namespace> ภายใต้องค์ประกอบ <XMLPayload> ตรงกับชื่อนำหน้าที่ระบุไว้ในข้อความแสดงข้อผิดพลาด (ขั้นตอนที่ 1 ด้านบน)

    ตัวอย่างเช่น นโยบายต่อไปนี้ระบุคำนำหน้าชื่อ Apigee ในองค์ประกอบ <Namespace> ซึ่งตรงกับข้อความแสดงข้อผิดพลาด

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
          <DisplayName>Regular Expression Protection-1</DisplayName>
          <Properties/>
          <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
          <Source>request</Source>
          <XMLPayload>
            <Namespaces>
              <Namespace prefix="apigee"/>
              <Namespace prefix="gmail">http://mail.google.com</Namespace>
            </Namespaces>
            <XPath>
              <Expression>/apigee:Greeting/apigee:User</Expression>
              <Type>string</Type>
              <Pattern>REGEX PATTERN</Pattern>
            </XPath>
          </XMLPayload>
        </RegularExpressionProtection>
    
  3. ตรวจสอบว่าองค์ประกอบ <Namespace> ที่มีคำนำหน้าที่เจาะจงซึ่งระบุไว้ในขั้นตอนที่ 2 มี URI ที่ถูกต้องหรือไม่ หากไม่มี URI แสดงว่าเป็นสาเหตุของข้อผิดพลาด

    ในตัวอย่างนโยบายการป้องกันนิพจน์ทั่วไปที่แสดงด้านบน ให้สังเกตว่าไม่มี URI ที่ตรงกับองค์ประกอบ <Namespace> ที่มีคำนำหน้า Apigee คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    Non-empty prefix apigee cannot be mapped to empty uri.

ความละเอียด

ตรวจสอบว่าองค์ประกอบ <Namespace> ทั้งหมดที่กําหนดด้วยคํานําหน้ามี URI ที่สอดคล้องกันในนโยบายการดึงข้อมูลตัวแปร เช่น

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
  <DisplayName>Regular Expression Protection-1</DisplayName>
  <Properties/>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
  <Source>request</Source>
  <XMLPayload>
    <Namespaces>
      <Namespace prefix="apigee">http://www.apigee.com</Namespace>
      <Namespace prefix="gmail">http://mail.google.com</Namespace>
    </Namespaces>
    <XPath>
      <Expression>/apigee:Greeting/apigee:User</Expression>
      <Type>string</Type>
      <Pattern>REGEX PATTERN</Pattern>
    </XPath>
  </XMLPayload>
</RegularExpressionProtection>

DuplicatePrefix

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
RegularExpressionProtection policy_name: Duplicate prefix prefix_name.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: Duplicate prefix apigee.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาดของการจำลองคำนำหน้าซ้ำ

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากนโยบาย regularExpressionProtection มีการใช้คำนำหน้าเดียวกันมากกว่า 1 ครั้งในองค์ประกอบ <Namespace> ภายใต้องค์ประกอบ <XMLPayload>

ตัวอย่างเช่น ข้อผิดพลาดนี้เกิดขึ้นเนื่องจากมีการกำหนดคำนำหน้า apigee 2 ครั้งตามที่แสดงด้านล่าง

<Namespace prefix="apigee">http://www.apigee.com</Namespace>
<Namespace prefix="apigee">http://www.apigee.com</Namespace>

การวินิจฉัย

  1. ระบุนโยบาย regularExpressionProtection ที่เกิดข้อผิดพลาดและชื่อของคำนำหน้า คุณจะพบทั้ง 2 รายการนี้ในข้อความแสดงข้อผิดพลาด

    ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ regular Expression Protection-1 และคำนำหน้าคือ Apigee

    RegularExpressionProtection Regular-Expression-Protection-1: Duplicate prefix apigee.
    
  2. ใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปไม่สำเร็จ ให้ตรวจสอบว่าชื่อของคำนำหน้าที่กำหนดไว้ในองค์ประกอบ <Namespace> ภายใต้องค์ประกอบ <XMLPayload> ตรงกับชื่อนำหน้าที่ระบุไว้ในข้อความแสดงข้อผิดพลาด (ขั้นตอนที่ 1 ด้านบน)

    ตัวอย่างเช่น นโยบายต่อไปนี้ระบุคำนำหน้าชื่อ Apigee ในองค์ประกอบ <Namespace> ซึ่งตรงกับข้อความแสดงข้อผิดพลาด

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
          <DisplayName>Regular Expression Protection-1</DisplayName>
          <Properties/>
          <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
          <Source>request</Source>
          <XMLPayload>
            <Namespaces>
              <Namespace prefix="apigee">http://www.apigee.com</Namespace>
              <Namespace prefix="apigee">http://www.apigee.com</Namespace>
            </Namespaces>
            <XPath>
              <Expression>/apigee:Greeting/apigee:User</Expression>
              <Type>string</Type>
              <Pattern>REGEX PATTERN</Pattern>
            </XPath>
          </XMLPayload>
        </RegularExpressionProtection>
    
  3. พิจารณาว่าองค์ประกอบ <Namespace> ที่มีคำนำหน้าที่เจาะจงตามที่ระบุไว้ในขั้นตอนที่ 2 มากกว่า 1 ครั้งหรือไม่ หากกำหนดไว้มากกว่า 1 ครั้ง ก็แสดงว่าเกิดจากข้อผิดพลาด

    ในตัวอย่างนโยบายการป้องกันนิพจน์ทั่วไปที่แสดงด้านบน ให้สังเกตว่ามีการกำหนดองค์ประกอบ <Namespace> ที่มีคำนำหน้า Apigee ไว้ 2 ครั้ง คุณจึงได้รับข้อผิดพลาด

    Duplicate prefix apigee.
    

ความละเอียด

ตรวจสอบว่ามีเพียงคำจำกัดความเดียวสำหรับคำนำหน้าแต่ละรายการในองค์ประกอบ <Namespace> ในนโยบาย regularExpressionProtection เช่น

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
      <DisplayName>Regular Expression Protection-1</DisplayName>
      <Properties/>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <Source>request</Source>
      <XMLPayload>
        <Namespaces>
          <Namespace prefix="apigee">http://www.apigee.com</Namespace>
        </Namespaces>
        <XPath>
          <Expression>/apigee:Greeting/apigee:User</Expression>
          <Type>string</Type>
          <Pattern>REGEX PATTERN</Pattern>
        </XPath>
      </XMLPayload>
    </RegularExpressionProtection>

EmptyXPathExpression

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
RegularExpressionProtection policy_name: Empty XPath expression.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: Empty XPath expression.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาด EmptyXPathExpression

สาเหตุ

หากนโยบาย regularExpressionProtection ไม่ได้ตั้งค่าเอลิเมนต์ <Expression> ไว้ภายในเอลิเมนต์ <XPath> จะทำให้ใช้งานพร็อกซี API ไม่สำเร็จ

การวินิจฉัย

  1. ระบุนโยบายการป้องกันนิพจน์ทั่วไปที่ล้มเหลวจากข้อความแสดงข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ regular-Expression-Protection-1

    RegularExpressionProtection Regular-Expression-Protection-1: Empty XPath expression.
    
  2. ใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปล้มเหลว ให้ตรวจสอบว่ามีองค์ประกอบ <XMLPayload> ที่มีองค์ประกอบย่อย <XPath> ที่ไม่มีองค์ประกอบ <Expression> กำหนดไว้หรือไม่ หรือองค์ประกอบ <Expression> ไม่ได้ตั้งค่าเป็นค่าใดๆ หากเป็นเช่นนั้น นั่นเป็นสาเหตุของข้อผิดพลาด

    ตัวอย่างเช่น นี่คือนโยบายการป้องกันนิพจน์ทั่วไปที่มีเอลิเมนต์ <XMLPayload>

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
      <DisplayName>Regular Expression Protection-1</DisplayName>
      <Properties/>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <Source>request</Source>
      <XMLPayload>
        <Namespaces>
          <Namespace prefix="apigee">http://www.apigee.com</Namespace>
        </Namespaces>
        <XPath>
          <Expression></Expression>
          <Type>string</Type>
          <Pattern>REGEX PATTERN</Pattern>
        </XPath>
      </XMLPayload>
    </RegularExpressionProtection>
    

    เนื่องจากมีองค์ประกอบ <Expression> ที่ว่างเปล่าภายในองค์ประกอบ <XPath> ทำให้ทำให้พร็อกซี API ใช้งานได้ไม่สำเร็จ

ความละเอียด

ตรวจสอบว่า นโยบาย regularExpressionProtection มีองค์ประกอบ <Expression> ที่ไม่ว่างเปล่าและถูกต้องซึ่งกำหนดภายใต้องค์ประกอบ <XPath> เช่น

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
  <DisplayName>Regular Expression Protection-1</DisplayName>
  <Properties/>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
  <Source>request</Source>
  <XMLPayload>
    <Namespaces>
      <Namespace prefix="apigee">http://www.apigee.com</Namespace>
    </Namespaces>
    <XPath>
      <Expression>/apigee:Greeting/apigee:User</Expression>
      <Type>string</Type>
      <Pattern>REGEX PATTERN</Pattern>
    </XPath>
  </XMLPayload>
</RegularExpressionProtection>

EmptyJSONPathExpression

ข้อความแสดงข้อผิดพลาด

การติดตั้งใช้งานพร็อกซี API ผ่าน Edge UI หรือ Edge Management API ล้มเหลวโดยมีข้อความแสดงข้อผิดพลาดนี้

Error Saving Revision revision_number
RegularExpressionProtection policy_name: Empty JSONPath expression.

ตัวอย่างข้อความแสดงข้อผิดพลาด

Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: Empty JSONPath expression.

ภาพหน้าจอตัวอย่างข้อผิดพลาด

ข้อความแสดงข้อผิดพลาด EmptyJSONPathExpression

สาเหตุ

หากนโยบาย regularExpressionProtection ไม่ได้ตั้งค่าเอลิเมนต์ <Expression> ไว้ภายในเอลิเมนต์ <JSONPath> จะทำให้ใช้งานพร็อกซี API ไม่สำเร็จ

การวินิจฉัย

  1. ระบุนโยบายการป้องกันนิพจน์ทั่วไปที่ล้มเหลวจากข้อความแสดงข้อผิดพลาด ตัวอย่างเช่น ในข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ regular-Expression-Protection-1

    Error Saving Revision 1
    RegularExpressionProtection Regular-Expression-Protection-1: Empty JSONPath expression.
    
  2. ใน XML ของนโยบายการป้องกันนิพจน์ทั่วไปไม่สำเร็จ ให้ตรวจสอบว่ามีองค์ประกอบ <JSONPayload> ที่มีองค์ประกอบย่อย <JSONPath> ที่ไม่มีองค์ประกอบ <Expression> กำหนดไว้หรือไม่ หรือองค์ประกอบ <Expression> ไม่ได้ตั้งค่าเป็นค่าใดๆ หากเป็นเช่นนั้น นั่นเป็นสาเหตุของข้อผิดพลาด

    ตัวอย่างเช่น นี่คือนโยบายการป้องกันนิพจน์ทั่วไปที่มีเอลิเมนต์ <JSONPayload>

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
          <DisplayName>Regular Expression Protection-1</DisplayName>
          <Properties/>
          <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
          <Source>request</Source>
          <JSONPayload>
            <JSONPath>
              <Expression></Expression>
              <Pattern>REGEX PATTERN</Pattern>
              <Pattern>REGEX PATTERN</Pattern>
            </JSONPath>
          </JSONPayload>
        </RegularExpressionProtection>
    

    เนื่องจากมีองค์ประกอบ <Expression> ที่ว่างเปล่าภายในองค์ประกอบ <JSONPath> ทำให้ทำให้พร็อกซี API ใช้งานได้ไม่สำเร็จ

ความละเอียด

ตรวจสอบว่า นโยบาย regularExpressionProtection มีองค์ประกอบ <Expression> ที่ไม่ว่างเปล่าและถูกต้องซึ่งกำหนดภายใต้องค์ประกอบ <JSONPath> เช่น

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RegularExpressionProtection async="false" continueOnError="false" enabled="true" name="Regular-Expression-Protection-1">
  <DisplayName>Regular Expression Protection-1</DisplayName>
  <Properties/>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
  <Source>request</Source>
  <JSONPayload>
    <JSONPath>
      <Expression>$.store.book[*].author</Expression>
      <Pattern>REGEX PATTERN</Pattern>
      <Pattern>REGEX PATTERN</Pattern>
    </JSONPath>
  </JSONPayload>
</RegularExpressionProtection>