From 48b213e3800038d96a4e19ff086d2a0f01e06759 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 8 Jan 2021 15:05:45 +0100 Subject: [PATCH] Configured httpresource to proxy all requests to the configured origin --- pom.xml | 9 +++++++-- .../httpresources/HttpResourcesDemoApplication.java | 11 +++++++++++ src/main/resources/application.properties | 8 +++++++- 3 files changed, 25 insertions(+), 3 deletions(-) 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..dd14ca8 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.web.resources.static-locations"=classpath:/overwrite/,${origin},classpath:/fallback/ +spring.thymeleaf.prefix=/ +spring.thymeleaf.suffix=.html +logging.level.de.juplo=DEBUG -- 2.20.1