Hello I was trying to write the rule below in Traefik:
Host(`localhost`) && HeadersRegexp(`Content-Type`, `application/grpc(?!-web)(.*)`)
Unfortunately I have discovered that golang does not have negative lookahead in regular expression.
How can I write it in a way that the golang regex engine will understand.
Thank you.
Hello @itachisasuke ,
https://regex101.com Is a good way to know learn and test go regexps.
Hope it helps
cakiwi
March 18, 2022, 1:05pm
3
Use the rule logical operators to advantage:
Host(`localhost`) && HeadersRegexp(`Content-Type`,`application/grpc.*`) && !HeadersRegexp(`Content-Type`,`application/grpc-web`)
2 Likes
Hello @tommoulard ,
I have done that unfortunately.The answer I get After googling is not supported in golang
Hello @cakiwi ,
This is very simple and great.
Am not sure why I did not think of the second part.
Thank you.
system
Closed
March 21, 2022, 1:44pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.