Skip to content

Commit 22e8961

Browse files
author
Jamie Curnow
committed
Fixes #104 - allow using / location in custom location
1 parent 4d5adef commit 22e8961

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/backend/internal/nginx.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const internalNginx = {
162162

163163
renderedLocations += await renderer.parseAndRender(template, locationCopy);
164164
}
165-
}
165+
};
166166

167167
locationRendering().then(() => resolve(renderedLocations));
168168
});
@@ -211,6 +211,14 @@ const internalNginx = {
211211
locationsPromise = internalNginx.renderLocations(host).then((renderedLocations) => {
212212
host.locations = renderedLocations;
213213
});
214+
215+
// Allow someone who is using / custom location path to use it, and skip the default / location
216+
_.map(host.locations, (location) => {
217+
if (location.path === '/') {
218+
host.use_default_location = false;
219+
}
220+
});
221+
214222
} else {
215223
locationsPromise = Promise.resolve();
216224
}

src/backend/internal/proxy-host.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const internalProxyHost = {
2525
}
2626

2727
return access.can('proxy_hosts:create', data)
28-
.then(access_data => {
28+
.then(() => {
2929
// Get a list of the domain names and check each of them against existing records
3030
let domain_name_check_promises = [];
3131

@@ -52,7 +52,7 @@ const internalProxyHost = {
5252
.omit(omissions())
5353
.insertAndFetch(data);
5454
})
55-
.then(row => {
55+
.then((row) => {
5656
if (create_certificate) {
5757
return internalCertificate.createQuickCertificate(access, data)
5858
.then(cert => {
@@ -69,21 +69,21 @@ const internalProxyHost = {
6969
return row;
7070
}
7171
})
72-
.then(row => {
72+
.then((row) => {
7373
// re-fetch with cert
7474
return internalProxyHost.get(access, {
7575
id: row.id,
7676
expand: ['certificate', 'owner', 'access_list']
7777
});
7878
})
79-
.then(row => {
79+
.then((row) => {
8080
// Configure nginx
8181
return internalNginx.configure(proxyHostModel, 'proxy_host', row)
8282
.then(() => {
8383
return row;
8484
});
8585
})
86-
.then(row => {
86+
.then((row) => {
8787
// Audit log
8888
data.meta = _.assign({}, data.meta || {}, row.meta);
8989

0 commit comments

Comments
 (0)