LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-19-2021, 08:16 AM   #1
owendelong
LQ Newbie
 
Registered: Mar 2005
Posts: 3

Rep: Reputation: 0
Apache 2.4 requests to non-SSL site with "Upgrade-Insecure-Requests: 1" and no trailing / get redirected to default site


Consider a web server with multiple virtual hosts (address based).
http://www.example.com/location/ is a fully formed URL and works.
http://www.example.com/location is missing the trailing /, so the web server produces a redirect to add it.
Finally, the default web site is http://www.othername.com and has both HTTP and HTTPs services with a proper certificate.

Without the "Upgrade-Insecure-Requests: 1" header, this works as expected.

However, add the aforementioned header and now the rewrite comes back as "https://www.othername.com/location/" instead of the expected (and desired) "http://www.example.com/location/".

It's not acceptable for "https://www.example.com/location/" because the www.example.com site is SSLEngine Off and has no port 443 listener configured, no certificate configured, etc.

However, it's also not acceptable to rewrite the domain name entirely, since the default site has a completely different document root and so the rewrite creates a 404 error.

I'm hoping someone can explain how to coerce Apache into doing what is expected here.

Thanks in advance,

Owen
 
Old 06-22-2021, 01:41 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Can you post conf and htaccess for www.example.com?
 
Old 06-22-2021, 02:08 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
If Upgrade-Insecure-Requests for example.com is on, and example.com is not listening on port 443, I would expect the server to drop back to the default domain.

But…I don’t find Upgrade-Insecure-Requests anywhere in the Apache documentation. Where, exactly, are you adding that “header”?
 
  


Reply

Tags
apache 2.4.7, http server, redirect, ssl



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
requests to 80 and 443 are redirected to another site when running iptables Kallisti Linux - Security 1 01-04-2010 06:42 AM
apache: basic auth over ssl (redirected) mattydee Linux - Server 4 11-09-2009 11:02 PM
creating an SSL page under non SSL site with apache1.33? taiwf Linux - Software 1 06-27-2006 01:06 AM
no trailing slash -> apache redirect to microsoft site? SerfurJ Linux - Software 6 03-15-2005 06:25 AM
localhost:901 gets redirected to "Power Linking" web site advertisement condosolon Linux - Newbie 2 03-04-2004 12:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration