diff --git a/support-portal-backend/src/main/java/net/shyshkin/study/fullstack/supportportal/backend/config/WebConfig.java b/support-portal-backend/src/main/java/net/shyshkin/study/fullstack/supportportal/backend/config/WebConfig.java
new file mode 100644
index 0000000..6d3a079
--- /dev/null
+++ b/support-portal-backend/src/main/java/net/shyshkin/study/fullstack/supportportal/backend/config/WebConfig.java
@@ -0,0 +1,29 @@
+package net.shyshkin.study.fullstack.supportportal.backend.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import java.io.File;
+
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+
+ @Value("${file.upload.directory}")
+ private String uploadDirectory;
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ // Make sure the path ends with a separator
+ String uploadPath = uploadDirectory;
+ if (!uploadPath.endsWith(File.separator)) {
+ uploadPath += File.separator;
+ }
+
+ // Serve uploaded files publicly at /uploads/**
+ registry.addResourceHandler("/uploads/**")
+ .addResourceLocations("file:" + uploadPath)
+ .setCachePeriod(3600); // Cache for 1 hour
+ }
+}
\ No newline at end of file
diff --git a/support-portal-backend/src/main/resources/application.yml b/support-portal-backend/src/main/resources/application.yml
index 6a04e4e..589d6dc 100644
--- a/support-portal-backend/src/main/resources/application.yml
+++ b/support-portal-backend/src/main/resources/application.yml
@@ -41,7 +41,7 @@ spring:
throw-exception-if-no-handler-found: true
web:
resources:
- add-mappings: false
+ add-mappings: true # Changed from false to true to serve static files
# File upload configuration
file:
@@ -50,10 +50,10 @@ file:
app:
base-url: ${APP_BASE_URL:http://localhost:8080}
- # Updated public URLs to include image endpoints
- public-urls: /user/login,/user/register,/user/*/profile-image,/user/*/profile-image/**,/professors,/professors/**,/api/posts,/api/posts/*,/api/posts/posted,/api/posts/tag/*,/api/posts/tags/count,/api/files/**,/professor,/professor/*,/api/events,/api/events/*,/api/public/**,/api/jobs/active,/api/job-applications,/api/courses/active,/api/courses/*,/api/course-applications,/api/upcoming-events/active
+ # Added /uploads/** to public URLs
+ public-urls: /user/login,/user/register,/user/*/profile-image,/user/*/profile-image/**,/professors,/professors/**,/api/posts,/api/posts/*,/api/posts/posted,/api/posts/tag/*,/api/posts/tags/count,/api/files/**,/uploads/**,/professor,/professor/*,/api/events,/api/events/*,/api/public/**,/api/jobs/active,/api/job-applications,/api/courses/active,/api/courses/*,/api/course-applications,/api/upcoming-events/active
cors:
- allowed-origins: http://localhost:4200,https://localhost:4200,http://localhost:3000,https://localhost:3000,http://art-support-portal.s3-website.eu-north-1.amazonaws.com,http://portal.shyshkin.net,*
+ allowed-origins: http://localhost:4200,https://localhost:4200,http://localhost:3000,https://localhost:3000,http://art-support-portal.s3-website.eu-north-1.amazonaws.com,http://portal.shyshkin.net,https://maincmc.rootxwire.com,https://cmcbackend.rootxwire.com
jwt:
secret: custom_text
@@ -67,9 +67,9 @@ file:
upload:
directory: /var/uploads/blog-images
app:
- base-url: https://cmcadminfrontend.com
+ base-url: https://cmcbackend.rootxwire.com
cors:
- allowed-origins: https://cmcadminfrontend.com,https://cmcadminfrontend.com
+ allowed-origins: https://maincmc.rootxwire.com,https://cmcbackend.rootxwire.com, https://cmcadminfrontend.rootxwire.com
---
# Development file upload configuration with custom directory
diff --git a/support-portal-frontend/src/app/component/education/education.component.html b/support-portal-frontend/src/app/component/education/education.component.html
index 1eed965..46ce6e5 100644
--- a/support-portal-frontend/src/app/component/education/education.component.html
+++ b/support-portal-frontend/src/app/component/education/education.component.html
@@ -1,3 +1,4 @@
+