Multiple PathPrefix entries within one rule for one router

Hello Team,

I am trying to find the right syntax to have many PathPrefix without repeating the Host entry.

Any advise? I read the doc but don't find is && and || can be used that way.

Merci

rule: "Host(`xxx.{{env "DOMAINNAME_CLOUD_SERVER"}}`) && ( 
        PathPrefix('/core/api/jeeApi.php(.*)$') ||
        PathPrefix('/data/(3d|backgrounds|fonts|img|object|plan|scenario|view)/(.*)$') ||
        PathPrefix('/plugins/JeedomConnect/core/api/JeedomConnect.api.php(.*)$') ||
        PathPrefix('/plugins/JeedomConnect/core/php/eventServer.php(.*)$') ||
        PathPrefix('/plugins/googlecast/tmp/(.*).mp3$') ||
        PathPrefix('/plugins/gsh/core/php/jeeGsh.php$') ||
        PathPrefix('/here.html$')
        )"

For exact matches, use Path and its prefixed alternative PathPrefix , for regexp matches, use PathRegexp .

Doc

Thanks @bluepuma77 I will try that. As it was written alternative, I thought that I could just go with PathPrefix.

Merci! I ll report the outcome for the benefits of everyone then (hopefully working one :D)

It might have changed with v3.

Ok so my issue was not with Path or PathPrefix but with ' versus `

Now it works with:

rule: "Host(`jeedom.{{env "DOMAINNAME_CLOUD_SERVER"}}`) && ( Path(`/core/api/jeeApi.php(.*)$`) ||
    PathPrefix(`/data/(3d|backgrounds|fonts|img|object|plan|scenario|view)/(.*)$`) ||
    PathPrefix(`/plugins/JeedomConnect/core/api/JeedomConnect.api.php(.*)$`) ||
    PathPrefix(`/plugins/JeedomConnect/core/php/eventServer.php(.*)$`) ||
    PathPrefix(`/plugins/googlecast/tmp/(.*).mp3$`) ||
    PathPrefix(`/plugins/gsh/core/php/jeeGsh.php$`) ||
    PathPrefix(`/here.html$`)
    )"

Merci

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.