VirtualHost not redirecting
I am trying to redirect http://eamondev.com:3000
to https://omniatm.eamondev.com
with a VirtualHost
. I am using node
to serve a site to http://eamondev.com:3000
. I am using vhost
with node like this:
app.use(vhost('omniatm.eamondev.com', express.static('/')));
I have never used vhost
and it took me a while to figure this out without having to split up all my code like I was working with more than one site (when I am not), so I'm not sure if it is exactly how it should be for an Apache redirect to work.
In my apache
conf
file I have:
<VirtualHost *:80>
ServerName omniatm.eamondev.com
ProxyPreserveHost on
ProxyPass / http://localhost:3000/
</VirtualHost>
I am also using WHM on a VPS, I'm not sure if this is relevant or not, but the ServerName
(with protocol, what I type into the browser) needs to be https://omniatm.eamondev.com
.
I cannot serve node
on port 80
of my server (and then redirect to subdomain) because my main site (http://eamondev.com) is running on port 80
.
I have referenced most of the stackoverflow questions about this and nothing has worked. I should mention (although I'm not sure exactly how it is relevant, I just saw it in a stackoverflow question I looked at), my hosting support (bluehost
) used WHM
to set things up with a wildcard ssl
certificate to make the omniatm.eamondev.com
subdomain https
.
How do I redirect http://eamondev.com:3000 to https://omniatm.eamondev.com using apache
(or vhost
)?
node.js apache redirect port virtualhost
add a comment |
I am trying to redirect http://eamondev.com:3000
to https://omniatm.eamondev.com
with a VirtualHost
. I am using node
to serve a site to http://eamondev.com:3000
. I am using vhost
with node like this:
app.use(vhost('omniatm.eamondev.com', express.static('/')));
I have never used vhost
and it took me a while to figure this out without having to split up all my code like I was working with more than one site (when I am not), so I'm not sure if it is exactly how it should be for an Apache redirect to work.
In my apache
conf
file I have:
<VirtualHost *:80>
ServerName omniatm.eamondev.com
ProxyPreserveHost on
ProxyPass / http://localhost:3000/
</VirtualHost>
I am also using WHM on a VPS, I'm not sure if this is relevant or not, but the ServerName
(with protocol, what I type into the browser) needs to be https://omniatm.eamondev.com
.
I cannot serve node
on port 80
of my server (and then redirect to subdomain) because my main site (http://eamondev.com) is running on port 80
.
I have referenced most of the stackoverflow questions about this and nothing has worked. I should mention (although I'm not sure exactly how it is relevant, I just saw it in a stackoverflow question I looked at), my hosting support (bluehost
) used WHM
to set things up with a wildcard ssl
certificate to make the omniatm.eamondev.com
subdomain https
.
How do I redirect http://eamondev.com:3000 to https://omniatm.eamondev.com using apache
(or vhost
)?
node.js apache redirect port virtualhost
add a comment |
I am trying to redirect http://eamondev.com:3000
to https://omniatm.eamondev.com
with a VirtualHost
. I am using node
to serve a site to http://eamondev.com:3000
. I am using vhost
with node like this:
app.use(vhost('omniatm.eamondev.com', express.static('/')));
I have never used vhost
and it took me a while to figure this out without having to split up all my code like I was working with more than one site (when I am not), so I'm not sure if it is exactly how it should be for an Apache redirect to work.
In my apache
conf
file I have:
<VirtualHost *:80>
ServerName omniatm.eamondev.com
ProxyPreserveHost on
ProxyPass / http://localhost:3000/
</VirtualHost>
I am also using WHM on a VPS, I'm not sure if this is relevant or not, but the ServerName
(with protocol, what I type into the browser) needs to be https://omniatm.eamondev.com
.
I cannot serve node
on port 80
of my server (and then redirect to subdomain) because my main site (http://eamondev.com) is running on port 80
.
I have referenced most of the stackoverflow questions about this and nothing has worked. I should mention (although I'm not sure exactly how it is relevant, I just saw it in a stackoverflow question I looked at), my hosting support (bluehost
) used WHM
to set things up with a wildcard ssl
certificate to make the omniatm.eamondev.com
subdomain https
.
How do I redirect http://eamondev.com:3000 to https://omniatm.eamondev.com using apache
(or vhost
)?
node.js apache redirect port virtualhost
I am trying to redirect http://eamondev.com:3000
to https://omniatm.eamondev.com
with a VirtualHost
. I am using node
to serve a site to http://eamondev.com:3000
. I am using vhost
with node like this:
app.use(vhost('omniatm.eamondev.com', express.static('/')));
I have never used vhost
and it took me a while to figure this out without having to split up all my code like I was working with more than one site (when I am not), so I'm not sure if it is exactly how it should be for an Apache redirect to work.
In my apache
conf
file I have:
<VirtualHost *:80>
ServerName omniatm.eamondev.com
ProxyPreserveHost on
ProxyPass / http://localhost:3000/
</VirtualHost>
I am also using WHM on a VPS, I'm not sure if this is relevant or not, but the ServerName
(with protocol, what I type into the browser) needs to be https://omniatm.eamondev.com
.
I cannot serve node
on port 80
of my server (and then redirect to subdomain) because my main site (http://eamondev.com) is running on port 80
.
I have referenced most of the stackoverflow questions about this and nothing has worked. I should mention (although I'm not sure exactly how it is relevant, I just saw it in a stackoverflow question I looked at), my hosting support (bluehost
) used WHM
to set things up with a wildcard ssl
certificate to make the omniatm.eamondev.com
subdomain https
.
How do I redirect http://eamondev.com:3000 to https://omniatm.eamondev.com using apache
(or vhost
)?
node.js apache redirect port virtualhost
node.js apache redirect port virtualhost
edited Nov 13 '18 at 13:51
ewizard
asked Nov 13 '18 at 13:36
ewizardewizard
1,09322469
1,09322469
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Proxy passing as given in the question will not do any redirects instead it will retain the URL as such and proxy the content from elsewhere. In Apache configuration, we have an option to do redirects, in the bellow sample, we are checking for the host and based on it issuing an redirect to the desired URL
<VirtualHost *:80>
ServerName omniatm.eamondev.com
Redirect / https://omniatm.eamondev.com
<If "%{HTTP_HOST} != 'eamondev.com:3000'">
Redirect "^/?(.*)" "https://omniatm.eamondev.com/$1"
</If>
</VirtualHost>
Please add some details description, so that anyone can understand your answer at a glance.
– SkyWalker
Nov 18 '18 at 17:19
thanks @jeevan, tied up at the moment with another project, i will try this soon and award points if it works
– ewizard
Nov 20 '18 at 13:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53282228%2fvirtualhost-not-redirecting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Proxy passing as given in the question will not do any redirects instead it will retain the URL as such and proxy the content from elsewhere. In Apache configuration, we have an option to do redirects, in the bellow sample, we are checking for the host and based on it issuing an redirect to the desired URL
<VirtualHost *:80>
ServerName omniatm.eamondev.com
Redirect / https://omniatm.eamondev.com
<If "%{HTTP_HOST} != 'eamondev.com:3000'">
Redirect "^/?(.*)" "https://omniatm.eamondev.com/$1"
</If>
</VirtualHost>
Please add some details description, so that anyone can understand your answer at a glance.
– SkyWalker
Nov 18 '18 at 17:19
thanks @jeevan, tied up at the moment with another project, i will try this soon and award points if it works
– ewizard
Nov 20 '18 at 13:04
add a comment |
Proxy passing as given in the question will not do any redirects instead it will retain the URL as such and proxy the content from elsewhere. In Apache configuration, we have an option to do redirects, in the bellow sample, we are checking for the host and based on it issuing an redirect to the desired URL
<VirtualHost *:80>
ServerName omniatm.eamondev.com
Redirect / https://omniatm.eamondev.com
<If "%{HTTP_HOST} != 'eamondev.com:3000'">
Redirect "^/?(.*)" "https://omniatm.eamondev.com/$1"
</If>
</VirtualHost>
Please add some details description, so that anyone can understand your answer at a glance.
– SkyWalker
Nov 18 '18 at 17:19
thanks @jeevan, tied up at the moment with another project, i will try this soon and award points if it works
– ewizard
Nov 20 '18 at 13:04
add a comment |
Proxy passing as given in the question will not do any redirects instead it will retain the URL as such and proxy the content from elsewhere. In Apache configuration, we have an option to do redirects, in the bellow sample, we are checking for the host and based on it issuing an redirect to the desired URL
<VirtualHost *:80>
ServerName omniatm.eamondev.com
Redirect / https://omniatm.eamondev.com
<If "%{HTTP_HOST} != 'eamondev.com:3000'">
Redirect "^/?(.*)" "https://omniatm.eamondev.com/$1"
</If>
</VirtualHost>
Proxy passing as given in the question will not do any redirects instead it will retain the URL as such and proxy the content from elsewhere. In Apache configuration, we have an option to do redirects, in the bellow sample, we are checking for the host and based on it issuing an redirect to the desired URL
<VirtualHost *:80>
ServerName omniatm.eamondev.com
Redirect / https://omniatm.eamondev.com
<If "%{HTTP_HOST} != 'eamondev.com:3000'">
Redirect "^/?(.*)" "https://omniatm.eamondev.com/$1"
</If>
</VirtualHost>
edited Nov 18 '18 at 17:43
answered Nov 18 '18 at 14:52
JeevanJeevan
1326
1326
Please add some details description, so that anyone can understand your answer at a glance.
– SkyWalker
Nov 18 '18 at 17:19
thanks @jeevan, tied up at the moment with another project, i will try this soon and award points if it works
– ewizard
Nov 20 '18 at 13:04
add a comment |
Please add some details description, so that anyone can understand your answer at a glance.
– SkyWalker
Nov 18 '18 at 17:19
thanks @jeevan, tied up at the moment with another project, i will try this soon and award points if it works
– ewizard
Nov 20 '18 at 13:04
Please add some details description, so that anyone can understand your answer at a glance.
– SkyWalker
Nov 18 '18 at 17:19
Please add some details description, so that anyone can understand your answer at a glance.
– SkyWalker
Nov 18 '18 at 17:19
thanks @jeevan, tied up at the moment with another project, i will try this soon and award points if it works
– ewizard
Nov 20 '18 at 13:04
thanks @jeevan, tied up at the moment with another project, i will try this soon and award points if it works
– ewizard
Nov 20 '18 at 13:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53282228%2fvirtualhost-not-redirecting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown