I can redirect the default Railway domain to the main domain that I have?
I want to set up a redirection for my default domain, for example, domain.up.railway.app redirect to domain.com.
7 Replies
Project ID:
N/A
You could probably set that up in your code
It didn't work, when I put domain.up.railway.ap the same domain continues to appear, it doesn't change.
that would be an issue with your code
My code:
import express from 'express';
import logger from 'morgan';
const app = express();
const port = config.PORT
app.use(express.json());
app.disable('x-powered-by')
app.use(logger('dev'))
app.use(express.static('client-microAngel'));
app.use((req, res, next) => {
if (req.hostname === "clinicamicropigmentacao.up.railway.app") {
console.log("n deu mano.....",req.url);
return res.redirect("https://clinicamicropigmentacao.com" + req.url);
}
next();
console.log("n deu mano.....",req.url);
});
app.get('/', (req, res) => {
res.sendFile(process.cwd() + '/client-microAngel/index.html');
});
app.listen(port, '0.0.0.0', () => {
console.log(
Servidor ouvindo na porta ${port}
);
});odd, I used the same middleware you used and it worked as expected for me
make sure you don't have other middleware that could be rerouting or blocking requests from propagating to the middleware responsible for redirecting
ok, i'll see