{"id":4982,"date":"2020-04-20T19:06:38","date_gmt":"2020-04-20T11:06:38","guid":{"rendered":"https:\/\/www.xttblog.com\/?p=4982"},"modified":"2020-04-20T19:06:38","modified_gmt":"2020-04-20T11:06:38","slug":"the-request-was-rejected-because-the-url-was-not-normalized","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=4982","title":{"rendered":"The request was rejected because the URL was not normalized"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u95ee\u9898\u9047\u5230\u7684\u4eba\u53ef\u80fd\u4e0d\u591a\uff0c\u4f46\u662f\u8fd8\u662f\u5f88\u81f4\u547d\u7684\u3002\u800c\u4e14\u4f60\u5f88\u96be\u5bdf\u89c9\u5230\u662f\u600e\u4e48\u9020\u6210\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u505a\u7684\u4e00\u4e2a OAuth2 \u5e73\u53f0\uff0c\u5df2\u7ecf\u7a33\u5b9a\u8fd0\u884c\u5f88\u4e45\u4e86\uff0c\u4f46\u662f\u6700\u8fd1\u4e00\u4e2a\u5c0f\u529f\u80fd\u7684\u6539\u52a8\uff0c\u88ab\u540c\u4e8b\u5347\u7ea7\u4e86 Spring Security \u7684 jar \u5305\u3002\u9020\u6210\u4e86\u5f88\u591a\u5ba2\u6237\u65e0\u6cd5\u6b63\u5e38\u8fdb\u884c OAuth \u8ba4\u8bc1\u3002\u7ed9\u516c\u53f8\u9020\u6210\u4e86\u4e0d\u5c0f\u7684\u5f71\u54cd\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u800c\u4e14\uff0c\u8fd9\u4e2a\u95ee\u9898\u5728\u5f00\u53d1\u548c\u6d4b\u8bd5\u73af\u5883\u90fd\u6ca1\u6709\u4e0d\u5bb9\u6613\u91cd\u73b0\u3002\u6211\u5728\u6e90\u7801\u4e2d\u641c\u5230\u4e86\u8fd9\u4e2a\u5f02\u5e38\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">RequestRejectedException: The request was rejected because the URL was not normalized<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL was not normalized.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u89e3\u51b3\u529e\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u6ca1\u6709\u7f51\u4e0a\u8bf4\u7684\u90a3\u4e48\u590d\u6742\uff0c\u6211\u7684\u6539\u52a8\u7b80\u5316\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@Configuration\npublic class WebSecurityConfig extends ResourceServerConfigurerAdapter {\n\n    @Bean\n    public HttpFirewall defaultHttpFirewall() {\n        return new DefaultHttpFirewall();\n    }\n\n    public void configure(WebSecurity web) throws Exception {\n        \/\/\u65b0\u9632\u706b\u5899\u5f3a\u5236\u8986\u76d6\u539f\u6765\u7684\n        web.httpFirewall(defaultHttpFirewall());\n        \/\/super.configure(web);\n    }\n\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c31\u4e0a\u9762\u51e0\u884c\u4ee3\u7801\u5c31\u53ef\u4ee5\u8f7b\u677e\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\uff0c\u5e2e\u52a9\u5176\u4ed6\u7f51\u53cb\u907f\u514d\u8df3\u5751\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=4982\">The request was rejected because the URL was not normalized<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u95ee\u9898\u9047\u5230\u7684\u4eba\u53ef\u80fd\u4e0d\u591a\uff0c\u4f46\u662f\u8fd8\u662f\u5f88\u81f4\u547d\u7684\u3002\u800c\u4e14\u4f60\u5f88\u96be\u5bdf\u89c9\u5230\u662f\u600e\u4e48\u9020\u6210\u7684\u3002 \u6211\u505a\u7684\u4e00\u4e2a OAuth2 \u5e73\u53f0\uff0c\u5df2 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1001,182,418,949,1317],"class_list":["post-4982","post","type-post","status-publish","format-standard","hentry","category-java","tag-oauth2","tag-oauth","tag-securitymanager","tag-securityutils","tag-security_err"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4982"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4982\/revisions"}],"predecessor-version":[{"id":4983,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4982\/revisions\/4983"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}