it_is_world_to_us
it_is_world_to_us

Reputation: 41

I want to rewrite URI in VirtualService for from regex to regex

I want to run the following API. While I want to run the following script. But I am not able to get the expected output.

 - match:
      uri:
        regex: \/test\/pune/\/(.+)\/bk
   rewrite:
      uri: \/pune/\/(.+)\/bk
    route:
    - destination:
        host: yerwada
        port:
          number: 8080

But I am getting following output -

{"level":50,"time":1581684841254,"pid":18,"hostname":"test-ob-scheduled-payments-7cfb6779b8-x6f9b","err":{"type":"Error","message":"Parse Error","stack":"Error: Parse Error","bytesParsed":4,"code":"HPE_INVALID_URL","rawPacket":{"type":"Buffer","data":[71,69,84,32,92,47,99,100,115,45,97,117,92,47,118,49,92,47,98]}},"v":1}

Upvotes: 4

Views: 1562

Answers (1)

Anmol Agrawal
Anmol Agrawal

Reputation: 904

HttpRewrite cannot use regex, it can only accept string values.

Upvotes: 2

Related Questions