---
title: "springmvc 路径参数有花括号导致400错误"
author: "learnmore"
date: "2022-01-20T14:32:00Z"
tags: []
categories: ["Web前端"]
slug: "springmvc-400"
draft: false
lastmod: "2022-01-29T09:49:44Z"
id: 2524239
url: "https://learnmore.iteye.com/blog/2524239"
---

#nginx地址重写，替换掉url 并且防止url decode方法

location /foo/bar/ {
  rewrite ^ $request_uri;               #转发原始url
  rewrite ^/foo/bar(/.*) /foo$1 break;  #重定向，去掉url中的/bar后缀
  proxy_pass http://localhost$uri;      #代理到新地址，并且转发原始的url,避免url解码
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
}