Skip to content

Equivalent to Apache's RewriteCond %{HTTP:Accept-Language} / RewriteRule wanted #2130

Answered by MihaZupan
personwithproxy asked this question in Q&A
Discussion options

You must be logged in to vote

The JSON config doesn't let you capture values from headers to use in the path right now.

If you only wanted to do this for a few languages, you can try something like this, where you define a separate route depending on the Accept-Language header value:

"Routes": {
  "catchAll": {
    "ClusterId": "myCluster",
    "Match": {
      "Path": "{**catch-all}"
    }
  },
  "help-ja": {
    "ClusterId": "myCluster",
    "Match": {
      "Path": "/svc/help/{**remainder}",
      "Headers": [
        { "Name": "Accept-Language", "Values": [ "ja" ], "Mode": "Contains" }
      ]
    },
    "Transforms": [
      { "PathPattern": "/svc/help/ja/{**remainder}" }
    ]
  },
  "help-ptBR": {
    "ClusterId"

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@personwithproxy
Comment options

Answer selected by Tratcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants