OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: dv8 on July 29, 2022, 09:37:05 pm

Title: How to return 404 for root domain
Post by: dv8 on July 29, 2022, 09:37:05 pm

I have a subdomain (ex. sub.domain.io) configured and working fine with Nginx over SSL.  I would like to configure the root domain (ex. domain.io) to return a 404 instead of forwarding to the same upstream server.  I know the configuration to do this in the /usr/local/etc/nginx/nginx.conf file is simple:

server {
    listen 443;
    server_name domain.io;
    return 404;
}

When I add this server to the conf and restart, the configuration is removed.  I assume Nginx is reapplying the GUI config.  How do I achieve the same simple server setup in the GUI?  I tried a new HTTP Server in the GUI with servername domain.io but it did not seem to work.

Thanks for your help!