Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Web Proxy Filtering and Caching
(Moderator:
fabian
) »
NGINX Reverse Proxy using subdomains only?
« previous
next »
Print
Pages: [
1
]
Author
Topic: NGINX Reverse Proxy using subdomains only? (Read 2782 times)
Crappysauce
Newbie
Posts: 4
Karma: 0
NGINX Reverse Proxy using subdomains only?
«
on:
August 07, 2021, 12:49:04 am »
Hi, I have a bunch of subdomains that I wish to redirect to their respective LAN servers using NGINX.
I set the HTTP servers according to the post here:
https://forum.opnsense.org/index.php?topic=19305.0
Everything seems to be find
except
if I enter my domain (eg. domain.com) instead of the subdomain (eg. subdomain1.domain.com), it uses the the first location that I have created.
Question is, how do I set it so that it only directs the subdomain traffic and ignore all requests to my domain?
Logged
fabian
Moderator
Hero Member
Posts: 2769
Karma: 200
OPNsense Contributor (Language, VPN, Proxy, etc.)
Re: NGINX Reverse Proxy using subdomains only?
«
Reply #1 on:
August 07, 2021, 12:25:01 pm »
Nginx and any other Webserver has to respond somehow to a request it gets.
The nginx developers decided that if you they don't have a matching server, they use the first or the default server. Since you cannot mark a server as a default, you will get the first one. If you don't want it to respond with that on the main domain, you can define it with an empty server that always responds with a default page or 404.
Logged
Crappysauce
Newbie
Posts: 4
Karma: 0
Re: NGINX Reverse Proxy using subdomains only?
«
Reply #2 on:
August 09, 2021, 11:36:49 pm »
Thanks fabian.
I'll play around with it, otherwise I might just go back to HAProxy for it's simplicity. Hoping I don't have to since Nginx allows for more(?) security with the WAF.
Then again, I'm still a total noob trying to learn all that I can on my own.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Web Proxy Filtering and Caching
(Moderator:
fabian
) »
NGINX Reverse Proxy using subdomains only?