CitrineOS Operator UI fully working - 15 stations, Hasura relations, CORS fixed
This commit is contained in:
@@ -2,46 +2,43 @@ server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
|
||||
# CORS headers
|
||||
# CORS headers for all responses
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Hasura-Admin-Secret" always;
|
||||
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Hasura-Admin-Secret, X-Hasura-Role, X-Hasura-User-Id, X-Hasura-Allowed-Roles" always;
|
||||
add_header Access-Control-Max-Age 3600 always;
|
||||
|
||||
# Handle preflight
|
||||
# Handle preflight OPTIONS
|
||||
if ($request_method = OPTIONS) {
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Hasura-Admin-Secret, X-Hasura-Role, X-Hasura-User-Id, X-Hasura-Allowed-Roles" always;
|
||||
add_header Access-Control-Max-Age 3600 always;
|
||||
add_header Content-Length 0;
|
||||
return 204;
|
||||
}
|
||||
|
||||
# Health check
|
||||
location /health {
|
||||
default_type application/json;
|
||||
return 200 '{"status":"ok"}';
|
||||
add_header Content-Type application/json;
|
||||
}
|
||||
|
||||
# System config - return empty config to satisfy UI
|
||||
# System config
|
||||
location /data/ocpprouter/systemConfig {
|
||||
default_type application/json;
|
||||
return 200 '{"userPreferences":{"telemetryConsent":false},"ocppRouter":{"networkProfile":"default"}}';
|
||||
}
|
||||
|
||||
# Proxy GraphQL requests to Hasura
|
||||
location /graphql {
|
||||
proxy_pass http://cariflex-hasura:8080/v1/graphql;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Hasura-Admin-Secret "Digitribe972";
|
||||
proxy_read_timeout 300;
|
||||
proxy_connect_timeout 60;
|
||||
}
|
||||
|
||||
# Default - proxy to Hasura
|
||||
location / {
|
||||
proxy_pass http://cariflex-hasura:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Hasura-Admin-Secret "Digitribe972";
|
||||
proxy_read_timeout 300;
|
||||
proxy_connect_timeout 60;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user