Description |
HTTP request-header comes with many fields. Just to list a few: Host, Content-Type, and Cookie. These common HTTP header fields provide essential information to help web servers obtain helpful information about clients. This article describes and demonstrates a script example to perform validation on an HTTP header, if conditions match, a certain action can be performed. In this instance, the HTTP request-header Host will be checked, and then if the condition matches, HTTP Host field value will be updated. |
Scope |
FortiADC. |
Solution |
Introduction: Company A tries to replace the HTTP Host header field value with the correct server domain information. FortiADC configurations were focused on server load balancing with Level 7 type without security profile common setup with a single real-server. This article focused on script examples. Hence, only scripting-related information will be published.
Create custom script:
2. Under the new edit window, input the suggested Lua script statement.
}
Note: Refer to the article for how to generate script log.
Validation:
Review Script log about the captured Host information.
Review the Web server log about the Host information.
Conclusion: Based on observer information, the client web request was sent correct domain, HTTP header was recorded under the script log accordingly. Furthermore, the Web server log confirmed script was functioning as expected while the domain was the correct domain, no further replacement will happen.
Review the Script log about the captured Host information.
Review the Web server log about the Host information.
Conclusion: Based on observer information, the client web request was sent with another domain, HTTP header was recorded under the script log accordingly, indicating it has executed the HTTP header replace function correctly. Furthermore, the Web server log confirmed script was functioning as expected while the domain was replaced with the correct domain.
Note:
|