add api for descriptor to root domain, tidying things up
This commit is contained in:
@ -20,7 +20,18 @@
|
||||
<div class="card">
|
||||
<h2>Matt-Cloud Cosmostat Dashboard</h2>
|
||||
This dashboard shows the local Matt-Cloud system stats.<p>
|
||||
<div class="help-link" id="helpToggle" >API</div>
|
||||
</div>
|
||||
|
||||
<div id="helpText" class="card">
|
||||
<strong>Component Desriptor</strong><p>
|
||||
To view the component descriptor, you may <br>
|
||||
<code>
|
||||
curl -s https://<?php echo $_SERVER['SERVER_NAME'] ?>/descriptor<br>
|
||||
</code>
|
||||
This will return the entire JSON descriptor variable
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div id="host_components" class="column">
|
||||
|
||||
@ -115,5 +126,17 @@
|
||||
<!-- matt-cloud redis script -->
|
||||
<script src="src/redis.js"></script>
|
||||
|
||||
<!-- Toggle the help text when the link is clicked -->
|
||||
<script>
|
||||
document.getElementById('helpToggle').addEventListener('click', function () {
|
||||
const help = document.getElementById('helpText');
|
||||
if (help.style.display === 'none' || help.style.display === '') {
|
||||
help.style.display = 'block';
|
||||
} else {
|
||||
help.style.display = 'none';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -49,3 +49,15 @@ li {
|
||||
#host_metrics_table tbody tr td :nth-of-type(even) {
|
||||
background-color: #3e5c78;
|
||||
}
|
||||
|
||||
.help-link{
|
||||
cursor:pointer;
|
||||
user-select:none;
|
||||
color: #2c3e50;
|
||||
text-align: right;
|
||||
}
|
||||
.help-link:hover{ text-decoration:underline; }
|
||||
|
||||
#helpText{
|
||||
display:none; /* hidden by default */
|
||||
}
|
||||
|
||||
@ -10,31 +10,40 @@ server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Proxy everything under "/" to the php server backend
|
||||
# --------------------------------------------------------------------
|
||||
location / {
|
||||
proxy_pass http://192.168.37.1:8080;
|
||||
# ---------------------------------------
|
||||
# The API – only /descriptor
|
||||
# ---------------------------------------
|
||||
location = /descriptor {
|
||||
proxy_pass http://192.168.37.1:5000/descriptor;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
# ----- Custom Nginx Configuration (inside <location> block) -----
|
||||
location /socket.io/ {
|
||||
# Forward to the Node WS server
|
||||
proxy_pass http://192.168.37.1:3000; # or <node_container_ip>
|
||||
proxy_set_header X-Forwarded-Proto $sceme;
|
||||
}
|
||||
|
||||
# Keep WebSocket upgrade headers
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
# ---------------------------------------
|
||||
# WebSocket endpoint
|
||||
# ---------------------------------------
|
||||
location /socket.io/ {
|
||||
proxy_pass http://192.168.37.1:3000/socket.io/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
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;
|
||||
}
|
||||
|
||||
# Optional: pass on other headers you care about
|
||||
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;
|
||||
}
|
||||
# ---------------------------------------
|
||||
# All other paths → Apache (PHP)
|
||||
# ---------------------------------------
|
||||
location / {
|
||||
proxy_pass http://192.168.37.1: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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user