From: Kai Moritz Date: Fri, 8 Jan 2021 14:05:45 +0000 (+0100) Subject: Configured httpresource to proxy all requests to the configured origin X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fproxy;p=demos%2Fhttpresources Configured httpresource to proxy all requests to the configured origin --- diff --git a/pom.xml b/pom.xml index 1b7fcd2..3cd520c 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,13 @@ spring-boot-starter-web - org.springframework.boot - spring-boot-starter-thymeleaf + de.juplo + http-resources + 2.0.0 + + + org.apache.httpcomponents + httpclient diff --git a/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java b/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java index 71b8a6d..aec1079 100644 --- a/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java +++ b/src/main/java/de/juplo/demo/httpresources/HttpResourcesDemoApplication.java @@ -2,10 +2,21 @@ package de.juplo.demo.httpresources; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; + @SpringBootApplication public class HttpResourcesDemoApplication { + @Bean + public ClientHttpRequestFactory clientHttpRequestFactory() + { + return new HttpComponentsClientHttpRequestFactory(); + } + + public static void main(String[] args) { SpringApplication.run(HttpResourcesDemoApplication.class, args); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b13789..c1ebc61 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,7 @@ - +server.port=8080 +origin=http://localhost:8888 +juplo.http-resources.protocol-resolver.enabled=true +spring.resources.static-locations=classpath:/overwrite/,${origin},classpath:/fallback/ +spring.thymeleaf.prefix=/ +spring.thymeleaf.suffix=.html +logging.level.de.juplo=DEBUG