mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-08-27 04:09:07 +00:00
Merge 771c06280f into a62c2a6dc3
This commit is contained in:
commit
f09d5fb602
34 changed files with 14453 additions and 14277 deletions
27
backend/migrations/20260518120000_use_http_host.js
Normal file
27
backend/migrations/20260518120000_use_http_host.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { migrate as logger } from "../logger.js";
|
||||
|
||||
const migrateName = "use_http_host";
|
||||
|
||||
const up = (knex) => {
|
||||
logger.info(`[${migrateName}] Migrating Up...`);
|
||||
return knex.schema
|
||||
.alterTable("proxy_host", (table) => {
|
||||
table.tinyint("use_http_host").notNullable().defaultTo(0);
|
||||
})
|
||||
.then(() => {
|
||||
logger.info(`[${migrateName}] proxy_host Table altered`);
|
||||
});
|
||||
};
|
||||
|
||||
const down = (knex) => {
|
||||
logger.info(`[${migrateName}] Migrating Down...`);
|
||||
return knex.schema
|
||||
.alterTable("proxy_host", (table) => {
|
||||
table.dropColumn("use_http_host");
|
||||
})
|
||||
.then(() => {
|
||||
logger.info(`[${migrateName}] proxy_host Table altered`);
|
||||
});
|
||||
};
|
||||
|
||||
export { up, down };
|
||||
|
|
@ -22,6 +22,7 @@ const boolFields = [
|
|||
"hsts_enabled",
|
||||
"hsts_subdomains",
|
||||
"trust_forwarded_proto",
|
||||
"use_http_host",
|
||||
];
|
||||
|
||||
class ProxyHost extends Model {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
"locations",
|
||||
"hsts_enabled",
|
||||
"hsts_subdomains",
|
||||
"trust_forwarded_proto"
|
||||
"trust_forwarded_proto",
|
||||
"use_http_host"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
@ -147,6 +148,11 @@
|
|||
"description": "Trust the forwarded headers",
|
||||
"example": false
|
||||
},
|
||||
"use_http_host": {
|
||||
"type": "boolean",
|
||||
"description": "Use $http_host (preserves port) instead of $host for the Host and X-Forwarded-Host headers",
|
||||
"example": false
|
||||
},
|
||||
"certificate": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@
|
|||
"locations": [],
|
||||
"hsts_enabled": false,
|
||||
"hsts_subdomains": false,
|
||||
"trust_forwarded_proto": false
|
||||
"trust_forwarded_proto": false,
|
||||
"use_http_host": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@
|
|||
"hsts_enabled": false,
|
||||
"hsts_subdomains": false,
|
||||
"trust_forwarded_proto": false,
|
||||
"use_http_host": false,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"created_on": "2025-10-28T00:50:24.000Z",
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@
|
|||
"trust_forwarded_proto": {
|
||||
"$ref": "../../../../components/proxy-host-object.json#/properties/trust_forwarded_proto"
|
||||
},
|
||||
"use_http_host": {
|
||||
"$ref": "../../../../components/proxy-host-object.json#/properties/use_http_host"
|
||||
},
|
||||
"http2_support": {
|
||||
"$ref": "../../../../components/proxy-host-object.json#/properties/http2_support"
|
||||
},
|
||||
|
|
@ -126,6 +129,7 @@
|
|||
"hsts_enabled": false,
|
||||
"hsts_subdomains": false,
|
||||
"trust_forwarded_proto": false,
|
||||
"use_http_host": false,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"created_on": "2025-10-28T00:50:24.000Z",
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@
|
|||
"trust_forwarded_proto": {
|
||||
"$ref": "../../../components/proxy-host-object.json#/properties/trust_forwarded_proto"
|
||||
},
|
||||
"use_http_host": {
|
||||
"$ref": "../../../components/proxy-host-object.json#/properties/use_http_host"
|
||||
},
|
||||
"http2_support": {
|
||||
"$ref": "../../../components/proxy-host-object.json#/properties/http2_support"
|
||||
},
|
||||
|
|
@ -123,6 +126,7 @@
|
|||
"hsts_enabled": false,
|
||||
"hsts_subdomains": false,
|
||||
"trust_forwarded_proto": false,
|
||||
"use_http_host": false,
|
||||
"certificate": null,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
location {{ path }} {
|
||||
{{ advanced_config }}
|
||||
|
||||
proxy_set_header Host $host;
|
||||
{% if use_http_host == 1 or use_http_host == true %}
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
{% else %}
|
||||
proxy_set_header Host $host;
|
||||
{% endif %}
|
||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ export interface ProxyHost {
|
|||
hstsEnabled: boolean;
|
||||
hstsSubdomains: boolean;
|
||||
trustForwardedProto: boolean;
|
||||
useHttpHost: boolean;
|
||||
// Expansions:
|
||||
owner?: User;
|
||||
accessList?: AccessList;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ const fetchProxyHost = (id: number | "new") => {
|
|||
hstsEnabled: false,
|
||||
hstsSubdomains: false,
|
||||
trustForwardedProto: false,
|
||||
useHttpHost: false,
|
||||
} as ProxyHost);
|
||||
}
|
||||
return getProxyHost(id, ["owner"]);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -437,6 +437,9 @@
|
|||
"host.flags.websockets-upgrade": {
|
||||
"defaultMessage": "Websockets Support"
|
||||
},
|
||||
"host.flags.use-http-host": {
|
||||
"defaultMessage": "Use $http_host (Preserve Port)"
|
||||
},
|
||||
"host.forward-port": {
|
||||
"defaultMessage": "Forward Port"
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -362,6 +362,9 @@
|
|||
"host.flags.websockets-upgrade": {
|
||||
"defaultMessage": "Tacaíocht Websockets"
|
||||
},
|
||||
"host.flags.use-http-host": {
|
||||
"defaultMessage": "Úsáid $http_host (Caomhnaigh an Port)"
|
||||
},
|
||||
"host.forward-port": {
|
||||
"defaultMessage": "Port Ar Aghaidh"
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -89,6 +89,7 @@ const ProxyHostModal = EasyModal.create(({ id, visible, remove }: Props) => {
|
|||
hstsEnabled: data?.hstsEnabled || false,
|
||||
hstsSubdomains: data?.hstsSubdomains || false,
|
||||
trustForwardedProto: data?.trustForwardedProto || false,
|
||||
useHttpHost: data?.useHttpHost || false,
|
||||
// Advanced tab
|
||||
advancedConfig: data?.advancedConfig || "",
|
||||
meta: data?.meta || {},
|
||||
|
|
@ -328,9 +329,32 @@ const ProxyHostModal = EasyModal.create(({ id, visible, remove }: Props) => {
|
|||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label className="row" htmlFor="useHttpHost">
|
||||
<span className="col">
|
||||
<T id="host.flags.use-http-host" />
|
||||
</span>
|
||||
<span className="col-auto">
|
||||
<Field name="useHttpHost" type="checkbox">
|
||||
{({ field }: any) => (
|
||||
<label className="form-check form-check-single form-switch">
|
||||
<input
|
||||
{...field}
|
||||
id="useHttpHost"
|
||||
className={cn("form-check-input", {
|
||||
"bg-lime": field.checked,
|
||||
})}
|
||||
type="checkbox"
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
</Field>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="tab-pane" id="tab-locations" role="tabpanel">
|
||||
<LocationsFields initialValues={data?.locations || []} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ describe('Proxy Hosts endpoints', () => {
|
|||
http2_support: false,
|
||||
hsts_enabled: false,
|
||||
hsts_subdomains: false,
|
||||
ssl_forced: false
|
||||
ssl_forced: false,
|
||||
use_http_host: false
|
||||
}
|
||||
}).then((data) => {
|
||||
cy.validateSwaggerSchema('post', 201, '/nginx/proxy-hosts', data);
|
||||
|
|
@ -42,6 +43,40 @@ describe('Proxy Hosts endpoints', () => {
|
|||
expect(data).to.have.property("enabled", true);
|
||||
expect(data).to.have.property('meta');
|
||||
expect(typeof data.meta.nginx_online).to.be.equal('undefined');
|
||||
expect(data).to.have.property('use_http_host', false);
|
||||
});
|
||||
});
|
||||
|
||||
it('Should be able to create a http host with use_http_host enabled', () => {
|
||||
cy.task('backendApiPost', {
|
||||
token: token,
|
||||
path: '/api/nginx/proxy-hosts',
|
||||
data: {
|
||||
domain_names: ['test2.example.com'],
|
||||
forward_scheme: 'http',
|
||||
forward_host: '1.1.1.1',
|
||||
forward_port: 80,
|
||||
access_list_id: '0',
|
||||
certificate_id: 0,
|
||||
meta: {
|
||||
dns_challenge: false
|
||||
},
|
||||
advanced_config: '',
|
||||
locations: [],
|
||||
block_exploits: false,
|
||||
caching_enabled: false,
|
||||
allow_websocket_upgrade: false,
|
||||
http2_support: false,
|
||||
hsts_enabled: false,
|
||||
hsts_subdomains: false,
|
||||
ssl_forced: false,
|
||||
use_http_host: true
|
||||
}
|
||||
}).then((data) => {
|
||||
cy.validateSwaggerSchema('post', 201, '/nginx/proxy-hosts', data);
|
||||
expect(data).to.have.property('id');
|
||||
expect(data.id).to.be.greaterThan(0);
|
||||
expect(data).to.have.property('use_http_host', true);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue