mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 15:53:33 +00:00 
			
		
		
		
	Support ipv6 address as a origin header, hopefully fixes #149
This commit is contained in:
		| @@ -4,11 +4,21 @@ module.exports = function (req, res, next) { | |||||||
|  |  | ||||||
| 	if (req.headers.origin) { | 	if (req.headers.origin) { | ||||||
|  |  | ||||||
|  | 		const originSchema = { | ||||||
|  | 			oneOf: [ | ||||||
|  | 				{ | ||||||
|  | 					type:    'string', | ||||||
|  | 					pattern: '^[a-z\\-]+:\\/\\/(?:[\\w\\-\\.]+(:[0-9]+)?/?)?$' | ||||||
|  | 				}, | ||||||
|  | 				{ | ||||||
|  | 					type:    'string', | ||||||
|  | 					pattern: '^[a-z\\-]+:\\/\\/(?:\\[([a-z0-9]{0,4}\\:?)+\\])?/?(:[0-9]+)?$' | ||||||
|  | 				} | ||||||
|  | 			] | ||||||
|  | 		}; | ||||||
|  |  | ||||||
| 		// very relaxed validation.... | 		// very relaxed validation.... | ||||||
| 		validator({ | 		validator(originSchema, req.headers.origin) | ||||||
| 			type:    'string', |  | ||||||
| 			pattern: '^[a-z\\-]+:\\/\\/(?:[\\w\\-\\.]+(:[0-9]+)?/?)?$' |  | ||||||
| 		}, req.headers.origin) |  | ||||||
| 			.then(function () { | 			.then(function () { | ||||||
| 				res.set({ | 				res.set({ | ||||||
| 					'Access-Control-Allow-Origin':      req.headers.origin, | 					'Access-Control-Allow-Origin':      req.headers.origin, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user