I have a website with Express that is on server alex.mysite.org. I want to add a subdomain, for example, test.alex.mysite.org. So I have this code:
var express = require('express');
var app = express();
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer();
var wildcardSubdomains = require('wildcard-subdomains');
app.use(wildcardSubdomains({
namespace: '_sub',
whitelist: ['www', 'main'],
}));
app.all('/_sub/teste/*', function(req, res) {
proxy.web(req, res, {target: 'http://127.0.0.1:3001'});
});
app.all('/*', function(req, res) {
proxy.web(req, res, {target: 'http://127.0.0.1:3000'});
});
app.listen(80);
Everything was working, but I added the 'wildcard-subdomains' module and now my website is giving a 404.
Can someone help me?
via alexandre1985
No comments:
Post a Comment