I have this string:
when HTTP_REQUEST{
path = HTTP:path_get()
debug("Path rewrite starts for Path %s ", path)
-- replace path which is /prefix/something/* so only /something/* stays in the path
HTTP:path_set("%s", path:gsub("/prefix", ""))
}
How to achieve the removal of the prefix? This script does not work. Also I don't see debug messages in the logs even though Scripting logging is enabled.
Thanks
Nominating a forum post submits a request to create a new Knowledge Article based on the forum post topic. Please ensure your nomination includes a solution within the reply.
Try running the regex directly to make sure it removes the prefix correctly. For example, try running the following code in your environment:
local path = "/prefix/something/example"
local modified_path = path:gsub("/prefix", ")
print(modified_path)
Hi, I guess missing " in your args for gsub is a typo, right?
Anyway I have added the log using print as you suggested, I still don't see anything in Script logs, but I have "Script Category" enabled in "Local log" settings.
How it is with logging at FortiADC, what else is needed to get the logs visible, do you know? Thanks
So after all it is "log" command to log stuff in Script, it is not "debug" nor "print".
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1705 | |
1093 | |
752 | |
446 | |
230 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.