Hey DeepSeek, can you write iRules?

Revisiting my article from 2 years ago, I asked the same question to DeepSeek and gave it the same tasks that I gave ChatGPT back then.

Back in time...

Two years ago I asked ChatGPT whether it could write iRules.

My conclusion after giving several tasks to ChatGPT was, that it can help with simple tasks but it cannot write intermediate or complex iRules.

A new AI enters the competition

Two weeks ago DeepSeek entered the scene and thought it's a good idea to ask it about its capabilities to write iRules.

Spoiler alert: It cannot.

New AI, same challenges

I asked DeepSeek the same questions I asked ChatGPT 2 years ago.

  1. Write me an iRule that redirects HTTP to HTTPS
  2. Can you write an iRule that rewrites the host header in HTTP Request and Response?
  3. Can you write an iRule that will make a loadbalancing decision based on the HTTP Host header?
  4. Can you write an iRule that will make a loadbalancing decision based on the HTTP URI header?
  5. Write me an iRule that shows different ASM blocking pages based on the host header. The response should include the support ID.

I stopped DeepSeek asking after the 5th question, DeepSeek is clueless about iRules.

The answer I got from DeepSeek to 1, 2, 4 and 5 was always the same:

when HTTP_REQUEST {
    # Check if the request is coming to port 80 (HTTP)
    if { [TCP::local_port] equals 80 } {
        # Construct the HTTPS URL
        set host [HTTP::host]
        set uri [HTTP::uri]
        set redirect_url "https://${host}${uri}"

        # Perform the redirect
        HTTP::redirect $redirect_url
    }
}

While this is a solution to task 1, it is plain wrong for 2, 3, 4 and 5.
And even for the first challenge this is not a good. Actually it hurts me reading this iRule...

Here for example task 2, just wrong...

For task 3 DeepSeeks answer was:

ChatGPT in 2025

For completeness, I gave the same tasks from 2023 to ChatGPT again.
Briefly said - ChatGPT was OK in solving tasks 1-4 in 2023 and still is. It improved it's solution for task 5, the ASM iRule challenge.
In 2023 I had two more tasks related to rewriting and redirecting. ChatGPT still failed to provide a solid solution for those two tasks.

Conclusion

DeepSeek cannot write iRules and ChatGPT still isn't good at it. Write your own iRules or ask the friendly people here on devcentral to help you.

 

Updated Feb 03, 2025
Version 2.0
    • Daniel_Wolf's avatar
      Daniel_Wolf
      Icon for MVP rankMVP

      I felt like this was overdue after 2 weeks of DeepSeek hype cycle.

  • Sending a query to DeepSeek. Cost = 3 tokens.
    Sending the same query to ChatGPT. Cost = 300+ tokens.
    Checking the validity of the results, with an expert plainly explaining the results: #Priceless

    • Daniel_Wolf's avatar
      Daniel_Wolf
      Icon for MVP rankMVP

      Plainly is good ... this is the version without my arsenal of curses ;)