Forward Apache ssl port 443 to Tomcat http port
I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.
My httpd.conf is as below:
Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
My ssl.conf is as below:
Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>
My server.xml connector is as below:
<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />
Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.
apache ssl tomcat8 proxypass
add a comment |
I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.
My httpd.conf is as below:
Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
My ssl.conf is as below:
Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>
My server.xml connector is as below:
<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />
Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.
apache ssl tomcat8 proxypass
Why can't you just use 443 on the app?
– elken
Nov 16 '18 at 8:27
try moving the ProxyPass directives inside the VirtualHost
– Eugène Adell
Nov 16 '18 at 11:07
add a comment |
I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.
My httpd.conf is as below:
Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
My ssl.conf is as below:
Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>
My server.xml connector is as below:
<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />
Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.
apache ssl tomcat8 proxypass
I have my tomcat running as standalone in my linux box on port 7778. I have configured apache to run on ssl on port 443.
My httpd.conf is as below:
Listen 80
<VirtualHost *:80>
ServerName www.domain.com
Redirect / https://www.example.com
</VirtualHost> -->
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
My ssl.conf is as below:
Listen 443
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
</VirtualHost>
My server.xml connector is as below:
<Connector port="7778" protocol="HTTP/1.1"
proxyName="www.domain.com" proxyPort="80" />
Issue is my Apache is not able to redirect to Tomcat on 7778 port and gives 503 error.
apache ssl tomcat8 proxypass
apache ssl tomcat8 proxypass
edited Nov 16 '18 at 11:12
Eugène Adell
1,9782721
1,9782721
asked Nov 16 '18 at 8:25
HimanshuHimanshu
395516
395516
Why can't you just use 443 on the app?
– elken
Nov 16 '18 at 8:27
try moving the ProxyPass directives inside the VirtualHost
– Eugène Adell
Nov 16 '18 at 11:07
add a comment |
Why can't you just use 443 on the app?
– elken
Nov 16 '18 at 8:27
try moving the ProxyPass directives inside the VirtualHost
– Eugène Adell
Nov 16 '18 at 11:07
Why can't you just use 443 on the app?
– elken
Nov 16 '18 at 8:27
Why can't you just use 443 on the app?
– elken
Nov 16 '18 at 8:27
try moving the ProxyPass directives inside the VirtualHost
– Eugène Adell
Nov 16 '18 at 11:07
try moving the ProxyPass directives inside the VirtualHost
– Eugène Adell
Nov 16 '18 at 11:07
add a comment |
1 Answer
1
active
oldest
votes
Two steps:
1 Firts confirm your Tomcat is ok.
Make sure you can connect to http://localhost:7778/website and get the expected response.
Then, for proxy support modify your Connector:
<Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />
2 Fix your Apache configuration
Here I assume:
- when you try http://www.example.com you are redirected to https://www.example.com
when you try https://www.example.com you get the response from Tomcat
Listen 80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
CustomLog "logs/80_access.log" combined
ErrorLog "logs/80_error.log"
Redirect / https://www.example.com
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias example.com
# While debugging
LogLevel debug
CustomLog "logs/443_access.log" combined
ErrorLog "logs/443_error.log"
SSLEngine On
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
# Proxy to Tomcat
ProxyRequests Off
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
</VirtualHost>
What you may have to adjust
- Log files directory
- certificate files directory
- LogLevel, remove debug mode once it works
- Make sure required modules are loaded.
apachectl -t
will let you know if you are missing any.
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%2f53333984%2fforward-apache-ssl-port-443-to-tomcat-http-port%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
Two steps:
1 Firts confirm your Tomcat is ok.
Make sure you can connect to http://localhost:7778/website and get the expected response.
Then, for proxy support modify your Connector:
<Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />
2 Fix your Apache configuration
Here I assume:
- when you try http://www.example.com you are redirected to https://www.example.com
when you try https://www.example.com you get the response from Tomcat
Listen 80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
CustomLog "logs/80_access.log" combined
ErrorLog "logs/80_error.log"
Redirect / https://www.example.com
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias example.com
# While debugging
LogLevel debug
CustomLog "logs/443_access.log" combined
ErrorLog "logs/443_error.log"
SSLEngine On
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
# Proxy to Tomcat
ProxyRequests Off
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
</VirtualHost>
What you may have to adjust
- Log files directory
- certificate files directory
- LogLevel, remove debug mode once it works
- Make sure required modules are loaded.
apachectl -t
will let you know if you are missing any.
add a comment |
Two steps:
1 Firts confirm your Tomcat is ok.
Make sure you can connect to http://localhost:7778/website and get the expected response.
Then, for proxy support modify your Connector:
<Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />
2 Fix your Apache configuration
Here I assume:
- when you try http://www.example.com you are redirected to https://www.example.com
when you try https://www.example.com you get the response from Tomcat
Listen 80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
CustomLog "logs/80_access.log" combined
ErrorLog "logs/80_error.log"
Redirect / https://www.example.com
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias example.com
# While debugging
LogLevel debug
CustomLog "logs/443_access.log" combined
ErrorLog "logs/443_error.log"
SSLEngine On
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
# Proxy to Tomcat
ProxyRequests Off
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
</VirtualHost>
What you may have to adjust
- Log files directory
- certificate files directory
- LogLevel, remove debug mode once it works
- Make sure required modules are loaded.
apachectl -t
will let you know if you are missing any.
add a comment |
Two steps:
1 Firts confirm your Tomcat is ok.
Make sure you can connect to http://localhost:7778/website and get the expected response.
Then, for proxy support modify your Connector:
<Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />
2 Fix your Apache configuration
Here I assume:
- when you try http://www.example.com you are redirected to https://www.example.com
when you try https://www.example.com you get the response from Tomcat
Listen 80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
CustomLog "logs/80_access.log" combined
ErrorLog "logs/80_error.log"
Redirect / https://www.example.com
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias example.com
# While debugging
LogLevel debug
CustomLog "logs/443_access.log" combined
ErrorLog "logs/443_error.log"
SSLEngine On
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
# Proxy to Tomcat
ProxyRequests Off
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
</VirtualHost>
What you may have to adjust
- Log files directory
- certificate files directory
- LogLevel, remove debug mode once it works
- Make sure required modules are loaded.
apachectl -t
will let you know if you are missing any.
Two steps:
1 Firts confirm your Tomcat is ok.
Make sure you can connect to http://localhost:7778/website and get the expected response.
Then, for proxy support modify your Connector:
<Connector port="7778" protocol="HTTP/1.1" proxyName="www.example.com" proxyPort="80" />
2 Fix your Apache configuration
Here I assume:
- when you try http://www.example.com you are redirected to https://www.example.com
when you try https://www.example.com you get the response from Tomcat
Listen 80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
CustomLog "logs/80_access.log" combined
ErrorLog "logs/80_error.log"
Redirect / https://www.example.com
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias example.com
# While debugging
LogLevel debug
CustomLog "logs/443_access.log" combined
ErrorLog "logs/443_error.log"
SSLEngine On
SSLCertificateFile /path/to/certificate/file
SSLCertificateKeyFile /path/to/key
# Proxy to Tomcat
ProxyRequests Off
ProxyPass / http://localhost:7778/website
ProxyPassReverse / http://localhost:7778/website
</VirtualHost>
What you may have to adjust
- Log files directory
- certificate files directory
- LogLevel, remove debug mode once it works
- Make sure required modules are loaded.
apachectl -t
will let you know if you are missing any.
answered Nov 16 '18 at 14:36
Nic3500Nic3500
3,33281829
3,33281829
add a comment |
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%2f53333984%2fforward-apache-ssl-port-443-to-tomcat-http-port%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
Why can't you just use 443 on the app?
– elken
Nov 16 '18 at 8:27
try moving the ProxyPass directives inside the VirtualHost
– Eugène Adell
Nov 16 '18 at 11:07