How to prevent 'Bad Request' error while opening HTTP address on a Apache server with SSL (with non-default...

"Rubric" as meaning "signature" or "personal mark" -- is this accepted usage?

With indentation set to `0em`, when using a line break, there is still an indentation of a size of a space

How to translate "red flag" into Spanish?

Will I lose my paid in full property

The art of proof summarizing. Are there known rules, or is it a purely common sense matter?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

Function to calculate red-edgeNDVI in Google Earth Engine

c++ diamond problem - How to call base method only once

Visa-free travel to the US using refugee travel document from Spain?

Mistake in years of experience in resume?

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

My bank got bought out, am I now going to have to start filing tax returns in a different state?

What's the difference between using dependency injection with a container and using a service locator?

Why did C use the -> operator instead of reusing the . operator?

How to get even lighting when using flash for group photos near wall?

Can you stand up from being prone using Skirmisher outside of your turn?

Why is this method for solving linear equations systems using determinants works?

Passing args from the bash script to the function in the script

Seek and ye shall find

Did the Roman Empire have penal colonies?

What is the least dense liquid under normal conditions?

How would this chord from "Rocket Man" be analyzed?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

What is it called when you ride around on your front wheel?



How to prevent 'Bad Request' error while opening HTTP address on a Apache server with SSL (with non-default port)?



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraSSL23_GET_SERVER_HELLO:unknown protocol when trying to access HTTPS URLCan't get SSL working with apache2 on Ubuntu server, port 443 seems to not be openHow to make apache2 serve HTTPS on port 443 and non-default ports?How to disable non-SSL on Apache on only the host without disabling in virtual hosts?Name based SSL Virtual Hosting ubuntu 16 and apache 2.4Get Apache2 running with nginx as reverse proxyNginx reverse proxy for Apache: does Apache need SSL certificates?virtual host preventing default serverHow to configure connection to service with SSL Certificate when using not apache service. SOSPretty URL's not working with HTTPS apache server





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















as you may know if you configure apache2 with SSL (non-default port) and open it with 'HTTP' address you will get this error:



https://[ip-address]:20443 --> http://[ip-address]:20443




Bad Request



Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.




If you use default port for SSL (443) the best solution is to redirect http to https (for example with 'Rewrite')
But if you use non-default ports this method doesn't work. Because http://:20443 and https://:20443 are on same port and apache2 cann't listen a port twice!



So how can i redirect http://:20443 to https://:20443 automatically?










share|improve this question























  • Since you are receiving a Bad request from the server, you may be able to create an error page that redirects to https. What is the exact status code you receive when calling the URL with HTTP?

    – Dan
    10 hours ago











  • based on access.log, it return 400 status code: "GET / HTTP/1.0" 400

    – Giac
    10 hours ago











  • In that case, I would argue that it is not possible as 400 is too generic and you can end up with infinite loop. Nginx has a cleaner solution for this as it defines a custom status code for this error, if you would be willing to use it instead of Apache ma.ttias.be/force-redirect-http-https-custom-port-nginx

    – Dan
    10 hours ago


















0















as you may know if you configure apache2 with SSL (non-default port) and open it with 'HTTP' address you will get this error:



https://[ip-address]:20443 --> http://[ip-address]:20443




Bad Request



Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.




If you use default port for SSL (443) the best solution is to redirect http to https (for example with 'Rewrite')
But if you use non-default ports this method doesn't work. Because http://:20443 and https://:20443 are on same port and apache2 cann't listen a port twice!



So how can i redirect http://:20443 to https://:20443 automatically?










share|improve this question























  • Since you are receiving a Bad request from the server, you may be able to create an error page that redirects to https. What is the exact status code you receive when calling the URL with HTTP?

    – Dan
    10 hours ago











  • based on access.log, it return 400 status code: "GET / HTTP/1.0" 400

    – Giac
    10 hours ago











  • In that case, I would argue that it is not possible as 400 is too generic and you can end up with infinite loop. Nginx has a cleaner solution for this as it defines a custom status code for this error, if you would be willing to use it instead of Apache ma.ttias.be/force-redirect-http-https-custom-port-nginx

    – Dan
    10 hours ago














0












0








0








as you may know if you configure apache2 with SSL (non-default port) and open it with 'HTTP' address you will get this error:



https://[ip-address]:20443 --> http://[ip-address]:20443




Bad Request



Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.




If you use default port for SSL (443) the best solution is to redirect http to https (for example with 'Rewrite')
But if you use non-default ports this method doesn't work. Because http://:20443 and https://:20443 are on same port and apache2 cann't listen a port twice!



So how can i redirect http://:20443 to https://:20443 automatically?










share|improve this question














as you may know if you configure apache2 with SSL (non-default port) and open it with 'HTTP' address you will get this error:



https://[ip-address]:20443 --> http://[ip-address]:20443




Bad Request



Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.




If you use default port for SSL (443) the best solution is to redirect http to https (for example with 'Rewrite')
But if you use non-default ports this method doesn't work. Because http://:20443 and https://:20443 are on same port and apache2 cann't listen a port twice!



So how can i redirect http://:20443 to https://:20443 automatically?







14.04 apache2 ssl redirect https






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 11 hours ago









GiacGiac

182




182













  • Since you are receiving a Bad request from the server, you may be able to create an error page that redirects to https. What is the exact status code you receive when calling the URL with HTTP?

    – Dan
    10 hours ago











  • based on access.log, it return 400 status code: "GET / HTTP/1.0" 400

    – Giac
    10 hours ago











  • In that case, I would argue that it is not possible as 400 is too generic and you can end up with infinite loop. Nginx has a cleaner solution for this as it defines a custom status code for this error, if you would be willing to use it instead of Apache ma.ttias.be/force-redirect-http-https-custom-port-nginx

    – Dan
    10 hours ago



















  • Since you are receiving a Bad request from the server, you may be able to create an error page that redirects to https. What is the exact status code you receive when calling the URL with HTTP?

    – Dan
    10 hours ago











  • based on access.log, it return 400 status code: "GET / HTTP/1.0" 400

    – Giac
    10 hours ago











  • In that case, I would argue that it is not possible as 400 is too generic and you can end up with infinite loop. Nginx has a cleaner solution for this as it defines a custom status code for this error, if you would be willing to use it instead of Apache ma.ttias.be/force-redirect-http-https-custom-port-nginx

    – Dan
    10 hours ago

















Since you are receiving a Bad request from the server, you may be able to create an error page that redirects to https. What is the exact status code you receive when calling the URL with HTTP?

– Dan
10 hours ago





Since you are receiving a Bad request from the server, you may be able to create an error page that redirects to https. What is the exact status code you receive when calling the URL with HTTP?

– Dan
10 hours ago













based on access.log, it return 400 status code: "GET / HTTP/1.0" 400

– Giac
10 hours ago





based on access.log, it return 400 status code: "GET / HTTP/1.0" 400

– Giac
10 hours ago













In that case, I would argue that it is not possible as 400 is too generic and you can end up with infinite loop. Nginx has a cleaner solution for this as it defines a custom status code for this error, if you would be willing to use it instead of Apache ma.ttias.be/force-redirect-http-https-custom-port-nginx

– Dan
10 hours ago





In that case, I would argue that it is not possible as 400 is too generic and you can end up with infinite loop. Nginx has a cleaner solution for this as it defines a custom status code for this error, if you would be willing to use it instead of Apache ma.ttias.be/force-redirect-http-https-custom-port-nginx

– Dan
10 hours ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1137745%2fhow-to-prevent-bad-request-error-while-opening-http-address-on-a-apache-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1137745%2fhow-to-prevent-bad-request-error-while-opening-http-address-on-a-apache-server%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...