Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions synkronus-portal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html

# Copy custom nginx configuration for SPA routing
# Backend API: http://demo.synkronus.cloud
# Backend API: http://demo.synkronus.cloud (remote demo server)
RUN echo 'server { \
listen 0.0.0.0:80; \
listen [::]:80; \
Expand All @@ -33,7 +33,8 @@ RUN echo 'server { \
location / { \
try_files $uri $uri/ /index.html; \
} \
# Proxy API requests to backend (demo.synkronus.cloud) \
# Proxy API requests to demo server (demo.synkronus.cloud) \
# Strip /api prefix since demo server uses routes without /api prefix \
location /api { \
rewrite ^/api(.*)$ $1 break; \
proxy_pass http://demo.synkronus.cloud; \
Expand All @@ -45,6 +46,9 @@ RUN echo 'server { \
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \
proxy_set_header X-Forwarded-Proto $scheme; \
proxy_set_header X-Forwarded-Host $host; \
# Explicitly pass Authorization header for authentication \
proxy_set_header Authorization $http_authorization; \
proxy_pass_request_headers on; \
proxy_connect_timeout 60s; \
proxy_send_timeout 60s; \
proxy_read_timeout 60s; \
Expand Down
3 changes: 2 additions & 1 deletion synkronus-portal/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export const api = {

// User management endpoints
async createUser(data: { username: string; password: string; role: string }): Promise<{ username: string; role: string; createdAt: string }> {
return request<{ username: string; role: string; createdAt: string }>('/users/create', {
// Use /users (not /users/create) to match CLI and demo server
return request<{ username: string; role: string; createdAt: string }>('/users', {
method: 'POST',
body: JSON.stringify(data),
})
Expand Down
3 changes: 3 additions & 0 deletions synkronus/internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ func NewRouter(log *logger.Logger, h *handlers.Handler) http.Handler {
// User management routes
userRoutes := func(r chi.Router) {
// Admin-only routes
// Support both POST /users and POST /users/create for compatibility
// CLI uses POST /users, portal uses POST /users/create
r.With(auth.RequireRole(models.RoleAdmin)).Post("/", h.CreateUserHandler)
r.With(auth.RequireRole(models.RoleAdmin)).Post("/create", h.CreateUserHandler)
r.With(auth.RequireRole(models.RoleAdmin)).Delete("/delete/{username}", h.DeleteUserHandler)
r.With(auth.RequireRole(models.RoleAdmin)).Post("/reset-password", h.ResetPasswordHandler)
Expand Down