{"id":3135,"date":"2020-03-06T14:25:47","date_gmt":"2020-03-06T13:25:47","guid":{"rendered":"https:\/\/myoceane.fr\/?p=3135"},"modified":"2020-03-16T07:59:58","modified_gmt":"2020-03-16T06:59:58","slug":"http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a","status":"publish","type":"post","link":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/","title":{"rendered":"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n\n<p style=\"text-align: justify;\">\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002<\/p>\n\n\n\n<h3>\u4f7f\u7528 Curl<\/h3>\n<p>curl \u662f\u4e00\u500b\u5728\u958b\u767c\u524d\u671f\u53ef\u4ee5\u5f88\u5feb\u901f\u4e86\u89e3 API \u904b\u4f5c\u65b9\u6cd5\u7684\u4f5c\u6cd5\uff0c\u66f4\u591a curl \u7684\u6307\u4ee4\u53ef\u4ee5<a href=\"https:\/\/myoceane.fr\/index.php\/elasticsearch-useful-curl-scripts\/\">\u53c3\u8003<\/a>\u3002<\/p>\n<pre class=\"lang:bash\">curl -X POST -u $user:$password\\\n     $url\\\n     -H \"Content-Type:application\/xml\" -H \"X-ContentName: ***.xml\"\\\n     --data-binary \"@\/path\/***.xml\" -o output.txt\\\n     --insecure -x http:\/\/proxy --proxy-user $proxy_user:$proxy_password<\/pre>\n<p>\u4ee5\u4e0a\u662f\u4e00\u500b\u6bd4\u8f03\u8907\u96dc\u7684 curl \u7bc4\u4f8b\uff0c\u4ee5\u4e0b\u6211\u5011\u4f86\u89e3\u6790\u4e0d\u540c\u7684\u53c3\u6578\u7684\u529f\u80fd\u8207\u5176\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<p><strong>&#8211;insecure<\/strong><\/p>\n<p>\u6709\u6642\u4e00\u4e9b\u5167\u90e8\u4f7f\u7528\u7684\u52a0\u5bc6 SSL \u7db2\u9801\u4f7f\u7528\u81ea\u7c3d\u6191\u8b49, \u5982\u679c\u7528 curl \u64f7\u53d6\u9019\u4e9b\u4f7f\u7528\u81ea\u7c3d\u6191\u8b49\u7684 SSL \u7db2\u9801\u5167\u5bb9\uff0c\u6703\u51fa\u73fe\u932f\u8aa4\uff0c\u8981\u907f\u514d\u9019\u500b\u60c5\u6cc1\uff0c\u9700\u8981\u5728 curl \u6307\u4ee4\u5f8c\u9762\u52a0\u4e0a\u201c&#8211;insecure\u201d \u53c3\u6578, \u9019\u6a23 curl \u4fbf\u4e0d\u6703\u6aa2\u67e5 SSL \u7684\u6709\u6548\u6027\u3002<\/p>\n<p><strong>&#8211;data-binary<\/strong><\/p>\n<p>&#8211;data-binary \u9019\u500b\u53c3\u6578\u4e3b\u8981\u662f\u5c07\u6307\u5b9a\u7684\u6a94\u6848\u8def\u5f91\u7684\u6a94\u6848\u5229\u7528\u4e8c\u9032\u4f4d\u7684\u65b9\u5f0f\u8b80\u9032\u4f86\u4e14\u4f9d\u9644\u5728 Http Request \u88e1\u9762\u3002<\/p>\n<p><strong>-o\/-O<\/strong><\/p>\n<p>\u5982\u679c curl \u6703\u6536\u5230 API \u7aef\u7684\u56de\u61c9\u8a0a\u606f\u7684\u8a71\uff0c\u53ef\u4ee5\u5229\u7528 -o \u9019\u500b\u53c3\u6578\u5c07 Reponse \u653e\u5728\u6307\u5b9a\u7684 txt \u7b49\u7b49\u7684\u6a94\u6848\u88e1\u9762\uff0c\u5982\u679c\u662f\u4f7f\u7528 -O \u7684\u8a71\u5247\u662f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u9060\u7aef\u7684\u6a94\u6848\u540d\u7a31\uff01<\/p>\n<p>\u5176\u4ed6\u66f4\u591a\u7684 curl \u6307\u4ee4\u53ef\u4ee5\u53c3\u8003\uff1a<a href=\"https:\/\/curl.haxx.se\/docs\/manpage.html\">https:\/\/curl.haxx.se\/docs\/manpage.html<\/a><\/p>\n\n\n\n<h3>\u4f7f\u7528 Spring-boot \u7684 RestTemplate<\/h3>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u521d\u59cb\u5316 RestTemplate \u7684\u7bc4\u4f8b\uff1a<\/p>\n<pre class=\"lang:java\">private String PROXY_URL;\nprivate String PROXY_HOST;\nprivate String PROXY_ACCOUNT;\nprivate String PROXY_PASSWORD;\nprivate int PROXY_PORT = 8080;\n\npublic RestTemplate initRestTemplate(){\n   \n    List&lt;ClientHttpRequestInterceptor&gt; interceptors = null;\n    CredentialsProvider credsProvider = new BasicCredentialsProvider();\n    credsProvider.setCredentials(\n    \tnew AuthScope(PROXY_URL, PROXY_PORT),\n    \tnew UsernamePasswordCredentials(PROXY_ACCOUNT, PROXY_PASSWORD)\n    );\n    Proxy myProxy = new java.net.Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_HOST, PROXY_PORT));\t    \n    SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();\n    requestFactory.setProxy(myProxy);\n    ClientHttpRequestFactory = factory = new InterceptingClientHttpRequestFactory(requestFactory, interceptors);\n    return new RestTemplate(factory);\n}<\/pre>\n<p>\u4f7f\u7528\u4ee5\u4e0a\u7684 Java \u7a0b\u5f0f\u78bc\u53ef\u4ee5\u900f\u904e Proxy \u5230\u9054\u5916\u7db2\u7684\u6307\u5b9a\u4f4d\u5740\uff0c\u4f46\u662f\u5982\u679c Proxy \u662f\u6709\u5e33\u5bc6\u4fdd\u8b77\u7684\u8a71\uff0c\u5247\u6703\u51fa\u73fe\u4ee5\u4e0b\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<\/p>\n<pre class=\"lang:bash\">ERROR[]() - Unexpected error occurred in scheduled task.\norg.springframework.web.client.ResourceAccessException: I\/O error on POST request for \"http:\/\/target_URL\": Unable to tunnel through proxy. Proxy returns \"HTTP\/1.1 407 authenticationrequired\"; nested exception is java.io.IOException:Unable to tunnel through proxy. Proxy returns \"HTTP\/1.1 407 authenticationrequired\"\n    at.org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:473)\n    at....\n    at....\nCaused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns \"HTTP\/1.1 407 authenticationrequired\"\n    at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2152)<\/pre>\n<p>\u5c07\u4ee5\u4e0b\u7684\u7a0b\u5f0f\u78bc\u52a0\u9032\u51fd\u5f0f\u4e2d\u5247\u53ef\u4ee5\u89e3\u6c7a\u4ee5\u4e0a\u7684\u932f\u8aa4\u8a0a\u606f\uff01<\/p>\n<pre class=\"lang:bash\">Authenticator.setDefault( \n    new Authenticator(){ \n        @Override \n        public PasswordAuthentication getPasswordAuthentication(){ \n            return new PasswordAuthentication(PROXY_ACCOUNT, PROXY_PASSWORD.toCharArray()); \n        } \n    } \n);<\/pre>\n<p style=\"text-align: justify;\">\u4ee5\u4e0a\u65b9\u6cd5\u7d93\u904e\u7b46\u8005\u6e2c\u8a66\u53ef\u4ee5\u5728 spring-boot \u7684\u74b0\u5883\u4e2d\u57f7\u884c\uff01\u4f46\u662f\u4e5f\u6709\u5f88\u591a\u5176\u4ed6\u521d\u59cb\u5316 RestTemplate \u7684\u65b9\u6cd5\u7b46\u8005\u4e26\u6c92\u6709\u6210\u529f\u904b\u884c\u8d77\u4f86\uff0c\u4f8b\u5982\u5176\u4e2d\u4e00\u500b\u5229\u7528 HttpClientBuilder \u8207 HttpComponentsClientHttpRequestFactory \u7684<a href=\"https:\/\/stackoverflow.com\/questions\/34319679\/using-proxy-with-httpcomponentsclienthttprequestfactory-and-resttemplate\">\u65b9\u6cd5<\/a>\u3002<\/p>\n<p>\u53e6\u5916\u4e5f\u53ef\u4ee5\u53c3\u8003<a href=\"https:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/html\/howto.html#howto-http-clients\">\u9023\u7d50<\/a>\u3002<\/p>\n\n\n\n<h3>\u4f7f\u7528 Mock \u4f86\u5efa\u7acb RestTemplate \u7684\u6e2c\u8a66\u74b0\u5883<\/h3>\n<p>\u5728\u4f7f\u7528 RestTemplate \u4f86\u57f7\u884c HTTP Session \u7684\u4efb\u52d9\u4e4b\u5f8c\uff0c\u70ba\u4e86\u589e\u52a0\u7a0b\u5f0f\u958b\u767c\u7a0b\u5f0f\u78bc\u7684\u8986\u84cb\u7387\uff0c\u53ef\u4ee5\u5229\u7528\u4ee5\u4e0b\u7684\u65b9\u6cd5\u4f86\u865b\u64ec\u5316\u9060\u7aef API \u884c\u70ba\u3002<\/p>\n<pre class=\"lang:java\">public class RestTemplateTest{\n\n    private static String URL = \"http:\/\/example.url\";\n    private String returnValue = \"&lt;msg&gt;Succeed&lt;\/msg&gt;\"\n    private RestTemplate restTemplate;\n    private MockRestServiceServer server;\n    \n    @Before \n    public void setup(){\n    \trestTemplate = new RestTemplate();\n    \tserver = MockRestServiceServer.bindTo(restTemplate).build();\n    \tthis.server.expect(ExpectedCount.once(), MockRestRequestMatchers.requestTo(URL))\n    \t    .andExpect(MockRestRequestMatchers.method(HttpMethod.POST))\n    \t    .andRespond(MockRestResponseCreators.withStatus(HttpStatus.OK).body(returnValue));\n    }\n\n    @Test\n    public void sendTest(){\n    \tString value = sendRequest();\n    \tAssert.assertEquals(value, returnValue);\n    }\n}<\/pre>\n<p>\u00a0<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002<\/p>\n","protected":false},"author":1,"featured_media":3206,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,8],"tags":[],"class_list":["post-3135","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it-technology","category-website"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane<\/title>\n<meta name=\"description\" content=\"\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/myoceane.fr\/index.php\/http-\u900f\u904e-proxy-\u8207-api-\u6e9d\u901a\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\" \/>\n<meta property=\"og:description\" content=\"\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/myoceane.fr\/index.php\/http-\u900f\u904e-proxy-\u8207-api-\u6e9d\u901a\/\" \/>\n<meta property=\"og:site_name\" content=\"\u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-06T13:25:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-16T06:59:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"952\" \/>\n\t<meta property=\"og:image:height\" content=\"330\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"\u6ab8\u6aac\u7238\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6ab8\u6aac\u7238\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/\"},\"author\":{\"name\":\"\u6ab8\u6aac\u7238\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\"},\"headline\":\"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a\",\"datePublished\":\"2020-03-06T13:25:47+00:00\",\"dateModified\":\"2020-03-16T06:59:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/\"},\"wordCount\":60,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\"},\"image\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg\",\"articleSection\":[\"IT Technology\",\"Website\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/\",\"url\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/\",\"name\":\"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane\",\"isPartOf\":{\"@id\":\"https:\/\/myoceane.fr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg\",\"datePublished\":\"2020-03-06T13:25:47+00:00\",\"dateModified\":\"2020-03-16T06:59:58+00:00\",\"description\":\"\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage\",\"url\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg\",\"contentUrl\":\"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg\",\"width\":952,\"height\":330},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/myoceane.fr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/myoceane.fr\/#website\",\"url\":\"https:\/\/myoceane.fr\/\",\"name\":\"M-Y-Oceane \u60f3\u65b9\u6d89\u6cd5\u3002\u91cf\u74f6\u5916\u7684\u5929\u7a7a\",\"description\":\"\u60f3\u65b9\u6d89\u6cd5, France, Taiwan, Health, Information Technology\",\"publisher\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/myoceane.fr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b\",\"name\":\"\u6ab8\u6aac\u7238\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g\",\"caption\":\"\u6ab8\u6aac\u7238\"},\"logo\":{\"@id\":\"https:\/\/myoceane.fr\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/myoceane.fr\/index.php\/author\/johnny5584767gmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","description":"\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/myoceane.fr\/index.php\/http-\u900f\u904e-proxy-\u8207-api-\u6e9d\u901a\/","og_locale":"en_US","og_type":"article","og_title":"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","og_description":"\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002","og_url":"https:\/\/myoceane.fr\/index.php\/http-\u900f\u904e-proxy-\u8207-api-\u6e9d\u901a\/","og_site_name":"\u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","article_published_time":"2020-03-06T13:25:47+00:00","article_modified_time":"2020-03-16T06:59:58+00:00","og_image":[{"width":952,"height":330,"url":"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg","type":"image\/jpeg"}],"author":"\u6ab8\u6aac\u7238","twitter_card":"summary_large_image","twitter_misc":{"Written by":"\u6ab8\u6aac\u7238","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#article","isPartOf":{"@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/"},"author":{"name":"\u6ab8\u6aac\u7238","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b"},"headline":"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a","datePublished":"2020-03-06T13:25:47+00:00","dateModified":"2020-03-16T06:59:58+00:00","mainEntityOfPage":{"@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/"},"wordCount":60,"commentCount":0,"publisher":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b"},"image":{"@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage"},"thumbnailUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg","articleSection":["IT Technology","Website"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/","url":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/","name":"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a - \u60f3\u65b9\u6d89\u6cd5 - \u91cf\u74f6\u5916\u7684\u5929\u7a7a M-Y-Oceane","isPartOf":{"@id":"https:\/\/myoceane.fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage"},"image":{"@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage"},"thumbnailUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg","datePublished":"2020-03-06T13:25:47+00:00","dateModified":"2020-03-16T06:59:58+00:00","description":"\u5728\u5167\u7db2\u5411\u5916\u7db2\u7684 API \u6e9d\u901a\u7684\u6642\u5019\uff0c\u6709\u6642\u5019\u56e0\u70ba\u7279\u5225\u7684\u5b89\u5168\u5c64\u7d1a\u8981\u6c42\uff0c\u9700\u8981\u900f\u904e\u5167\u7db2\u7684 Proxy \u8207\u5728\u5916\u7db2\u7684 API \u6e9d\u901a\uff0c\u6b64\u6642\u6703\u50be\u5411\u900f\u904e Proxy \u626e\u6f14\u985e\u4f3c DNS \u7684\u89d2\u8272\uff01\u672c\u7bc7\u60f3\u8981\u6574\u7406\u4e26\u8a18\u9304\u5169\u500b\u53ef\u4ee5\u4f7f\u7528\u7684\u65b9\u6cd5\uff01\u5206\u5225\u662f\u5229\u7528 Curl \u8207 Spring-boot \u4e2d\u7684 RestTemplate\u3002","breadcrumb":{"@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#primaryimage","url":"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg","contentUrl":"https:\/\/myoceane.fr\/wp-content\/uploads\/2020\/03\/spring.jpg","width":952,"height":330},{"@type":"BreadcrumbList","@id":"https:\/\/myoceane.fr\/index.php\/http-%e9%80%8f%e9%81%8e-proxy-%e8%88%87-api-%e6%ba%9d%e9%80%9a\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/myoceane.fr\/"},{"@type":"ListItem","position":2,"name":"[Http] \u900f\u904e Proxy \u8207 API \u6e9d\u901a"}]},{"@type":"WebSite","@id":"https:\/\/myoceane.fr\/#website","url":"https:\/\/myoceane.fr\/","name":"M-Y-Oceane \u60f3\u65b9\u6d89\u6cd5\u3002\u91cf\u74f6\u5916\u7684\u5929\u7a7a","description":"\u60f3\u65b9\u6d89\u6cd5, France, Taiwan, Health, Information Technology","publisher":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/myoceane.fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/4a4552fb8c27693083d465e12db7658b","name":"\u6ab8\u6aac\u7238","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6cc678684664f8ad45a8d56a6630b183?s=96&d=mm&r=g","caption":"\u6ab8\u6aac\u7238"},"logo":{"@id":"https:\/\/myoceane.fr\/#\/schema\/person\/image\/"},"url":"https:\/\/myoceane.fr\/index.php\/author\/johnny5584767gmail-com\/"}]}},"amp_enabled":false,"_links":{"self":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/3135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/comments?post=3135"}],"version-history":[{"count":62,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/3135\/revisions"}],"predecessor-version":[{"id":3224,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/posts\/3135\/revisions\/3224"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/media\/3206"}],"wp:attachment":[{"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/media?parent=3135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/categories?post=3135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myoceane.fr\/index.php\/wp-json\/wp\/v2\/tags?post=3135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}