From ad95e2491d98ba14192735694fd149561a8412bf Mon Sep 17 00:00:00 2001 From: Khanh Nguyen <119989010+ndkhanh-axonivy@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:13:03 +0700 Subject: [PATCH] Feature/marp 721 fix nginx cannot redirect user after authenticated from GitHub (#49) --- marketplace-build/config/nginx/nginx.conf | 16 ++++++++++++---- .../com/axonivy/market/config/WebConfig.java | 4 ++-- .../market/service/impl/FeedbackServiceImpl.java | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/marketplace-build/config/nginx/nginx.conf b/marketplace-build/config/nginx/nginx.conf index e9fe9ac0c..a33e0ff50 100644 --- a/marketplace-build/config/nginx/nginx.conf +++ b/marketplace-build/config/nginx/nginx.conf @@ -1,12 +1,20 @@ -events{} +events {} http { - # include the default mime.types to map file extensions to MIME types include /etc/nginx/mime.types; server { - root /usr/share/nginx/html; + root /usr/share/nginx/html; index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + error_page 404 /404.html; + location = /404.html { + internal; + } } -} +} \ No newline at end of file diff --git a/marketplace-service/src/main/java/com/axonivy/market/config/WebConfig.java b/marketplace-service/src/main/java/com/axonivy/market/config/WebConfig.java index 0ff332d8c..b6d22d870 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/config/WebConfig.java +++ b/marketplace-service/src/main/java/com/axonivy/market/config/WebConfig.java @@ -12,7 +12,7 @@ public class WebConfig implements WebMvcConfigurer { private static final String[] EXCLUDE_PATHS = { "/", "/swagger-ui/**", "/api-docs/**" }; private static final String[] ALLOWED_HEADERS = { "Accept-Language", "Content-Type", "Authorization", "X-Requested-By", "x-requested-with", "X-Forwarded-Host", "x-xsrf-token" }; - private static final String[] ALLOWED_METHODS = { "GET", "OPTIONS" }; + private static final String[] ALLOWED_METHODS = { "GET", "OPTIONS", "POST" }; private final MarketHeaderInterceptor headerInterceptor; @@ -30,7 +30,7 @@ public void addInterceptors(InterceptorRegistry registry) { @Override public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**").allowedOrigins("*").allowedMethods(ALLOWED_METHODS).allowedHeaders(ALLOWED_HEADERS) + registry.addMapping("/**").allowedOrigins("http://marketplace.server.ivy-cloud.com:4200").allowedMethods(ALLOWED_METHODS).allowedHeaders(ALLOWED_HEADERS) .maxAge(marketCorsAllowedOriginMaxAge); } } \ No newline at end of file diff --git a/marketplace-service/src/main/java/com/axonivy/market/service/impl/FeedbackServiceImpl.java b/marketplace-service/src/main/java/com/axonivy/market/service/impl/FeedbackServiceImpl.java index 4305fe0e8..85760e37b 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/service/impl/FeedbackServiceImpl.java +++ b/marketplace-service/src/main/java/com/axonivy/market/service/impl/FeedbackServiceImpl.java @@ -35,7 +35,7 @@ public FeedbackServiceImpl(FeedbackRepository feedbackRepository, UserRepository @Override public Page findFeedbacks(String productId, Pageable pageable) throws NotFoundException { validateProductExists(productId); - return feedbackRepository.searchByProductId(productId, pageable); + return feedbackRepository.searchByProductId("", pageable); } @Override