So I figured it out:
Copilot first suggested to use request url: "/generic-webhook-trigger/invoke?token=mytoken"
this was wrong because it created an invalid url.
It seems that you cannot rewrite an invalid url with Nginx on Opnsense. So it could never work.
I changed the devops webhook to url: "/generic-webhook-trigger/invoke/token/mytoken"
Problem here is that jenkins accepts this format: http://JENKINS_URL/generic-webhook-trigger/invoke?token=TOKEN_HERE
So I still had to rewrite the now valid url from devops webhook.
used the following in nginx on opnsense:
location:
URL pattern: /generic-webhook-trigger/invoke
URL rewriting: MyRule
URL Rewriting:
Description: Myrule
Original URL Pattern: ^/generic-webhook-trigger/invoke/token/([^/]+)/git/notifyCommit$
New URL Pattern: /generic-webhook-trigger/invoke?token=$1
Flag: stop processing rules
Now the pipeline in Jenkins gets triggered when commiting a change to my Azure Devops Branch.
Still needs a bit of tweaking but at least I got it working.
Copilot first suggested to use request url: "/generic-webhook-trigger/invoke?token=mytoken"
this was wrong because it created an invalid url.
It seems that you cannot rewrite an invalid url with Nginx on Opnsense. So it could never work.
I changed the devops webhook to url: "/generic-webhook-trigger/invoke/token/mytoken"
Problem here is that jenkins accepts this format: http://JENKINS_URL/generic-webhook-trigger/invoke?token=TOKEN_HERE
So I still had to rewrite the now valid url from devops webhook.
used the following in nginx on opnsense:
location:
URL pattern: /generic-webhook-trigger/invoke
URL rewriting: MyRule
URL Rewriting:
Description: Myrule
Original URL Pattern: ^/generic-webhook-trigger/invoke/token/([^/]+)/git/notifyCommit$
New URL Pattern: /generic-webhook-trigger/invoke?token=$1
Flag: stop processing rules
Now the pipeline in Jenkins gets triggered when commiting a change to my Azure Devops Branch.
Still needs a bit of tweaking but at least I got it working.