Azure-docs: http yaml sample

Created on 6 Dec 2018  Â·  4Comments  Â·  Source: MicrosoftDocs/azure-docs

can you please provide an example of HTTP rule in yaml? If I try the following visual studio fails with an error:

    http:
      name: web
      port: 80
      hosts:
        - name: "*"
          routes:
          - match:
              path:
                value: "/first"
                rewrite: "/"
                type: Prefix
            destination:
              applicationName: TwoApis
              serviceName: Api1
              endpointName: Api1Listener

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

assigned-to-author doc-bug service-fabric-messvc triaged

Most helpful comment

@aloneguid
Could you try this:

    http:
      - name: web
        port: 8090
        hosts:
          - name: "*"
            routes:
              - name: "n"
                match:
                  path:
                    value: "/first"
                    rewrite: "/"
                    type: Prefix
                destination:
                  applicationName: TwoApis
                  serviceName: Api1
                  endpointName: Api1Listener

As per the schema, routes requires a "name". We will fix the sample and docs.

All 4 comments

Thanks for the feedback! We are currently investigating and will update you shortly.

@aloneguid
Could you try this:

    http:
      - name: web
        port: 8090
        hosts:
          - name: "*"
            routes:
              - name: "n"
                match:
                  path:
                    value: "/first"
                    rewrite: "/"
                    type: Prefix
                destination:
                  applicationName: TwoApis
                  serviceName: Api1
                  endpointName: Api1Listener

As per the schema, routes requires a "name". We will fix the sample and docs.

@kavyako yes, I can confirm it works by adding name, thank you!
By the way if it makes a difference, I also had to change

                  path:
                    value: "/first"
                    rewrite: "/"
                    type: Prefix

to

                  path:
                    value: "/first/"
                    rewrite: "/"
                    type: Prefix

because rewrite leaves double slash in the url if I use original sample.

@MicahMcKittrick-MSFT
Please close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Favna picture Favna  Â·  3Comments

varma31 picture varma31  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments