Skip to content

Commit 3666b9f

Browse files
committed
feat: essential configuration options for deployers
This commit makes everything a ton easier for deployers, adding configuration options to allow nip.io domains or all origins to access Puter for ideal LAN or VPN configurations.
1 parent d3da9da commit 3666b9f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

doc/self-hosters/domains.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@
66

77
Ensure the hosting device has a static IP address to prevent potential connectivity issues due to IP changes. This setup will enable seamless access to Puter and its services across your local network.
88

9+
### Using `nip.io`
10+
11+
We recommend this configuration for LAN setups. All you need to do is set the following
12+
at root level in your configuration file:
13+
14+
```json
15+
"allow_nipio_domains": true
16+
```
17+
18+
Puter requires multiple origins to work correctly. `nip.io` is a wildcard DNS for IP addresses,
19+
so Puter can still have multiple subdomains and you don't need to configure your own DNS or
20+
hosts file.
21+
922
### Using Hosts Files
1023

1124
The hosts file is a straightforward way to map domain names to IP addresses on individual devices. It's simple to set up but requires manual changes on each device that needs access to the domains.

src/backend/src/modules/web/WebServerService.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,22 @@ class WebServerService extends BaseService {
449449
'at.' + config.static_hosting_domain.toLowerCase(),
450450
];
451451

452+
if ( config.allow_nipio_domains ) {
453+
allowedDomains.push('nip.io');
454+
}
455+
452456
// Retrieve the Host header and ensure it's in a valid format
453457
const hostHeader = req.headers.host;
454458

455-
if (!hostHeader) {
459+
if ( ! config.allow_no_host_header && ! hostHeader ) {
456460
return res.status(400).send('Missing Host header.');
457461
}
458462

463+
if ( config.allow_all_host_values ) {
464+
next();
465+
return;
466+
}
467+
459468
// Parse the Host header to isolate the hostname (strip out port if present)
460469
const hostName = hostHeader.split(':')[0].trim().toLowerCase();
461470

0 commit comments

Comments
 (0)