What software produces this pattern of redirect? - wordpress

I am trying to activate HTTPS on my website but something is producing a redirect from HTTPS to a subdomain. Web guy says its the server. Server guy says its the app. I checked the vhost and httpd.conf and there is no redirect that matches. The application is Wordpress but there is no instance of the subdomain existing in the database or the source code.
Please take a look at the server response. Do you recognize what software produces this pattern of response?
$ curl -i https://www.example.com
HTTP/1.1 200 OK
Date: Tue, 23 Jan 2018 17:06:20 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.1.11
Last-Modified: Tue, 13 Jun 2006 16:25:18 GMT
ETag: "9b-4161d83351780"
Accept-Ranges: bytes
Content-Length: 155
Content-Type: text/html; charset=UTF-8
<html>
<head>
<META HTTP-EQUIV="Refresh"
CONTENT="0; URL=http://somewhereelse.example.com">
<title> redirecting...
</title></head>
<body> </body>
</html>

Related

How to generate an HTTP POST request using Telnet?

Does anyone know how to add HTTP body parameters into a request? I've tried something like...
telnet xxxx.com 80
Trying 128.x.xxx.45...
Connected to xxxx.com.
Escape character is '^]'.
POST /webapps/methods/check-post HTTP/1.1
Host: xxxx.com
Content-Type: application/json; charset=utf-8
{"id":"myid","color":"blue"}
But I got a '400 bad request' response
HTTP/1.1 400 Bad Request
Date: Thu, 31 Aug 2017 13:54:32 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 311
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at xxxx.com Port 80</address>
</body></html>
Connection closed by foreign host.
Can anyone help me to set up a correct HTTP post request with parameters, using Telnet?
Just add another empty line between the HTTP request header and HTTP request body.The parameter should be something like: key1=value1&key2=value2

Where does this Content-Length come from?

I visit the page http://furryfaust.com/waveform and it redirects to http://furyfaust.com/waveform/ with this initial response.
HTTP/1.1 301 Moved Permanently
Location: /waveform/
Date: Sat, 09 Jul 2016 21:32:56 GMT
Content-Length: 45
Content-Type: text/html; charset=utf-8
I found this out using chrome developer tools. I'm curious where the content-length is determined from since there is no response message body.
The page is served by a web framework called gin (https://github.com/gin-gonic/gin).
There is a content. The developer-tools don't show it for some reason, but using telnet I got the following response:
HTTP/1.1 301 Moved Permanently
Location: /waveform/
Date: Sat, 09 Jul 2016 21:40:38 GMT
Content-Length: 45
Content-Type: text/html; charset=utf-8
Moved Permanently.
Why the dev-tools don't show it? I don't know. Probably because Chrome doesn't even read the content because it'll redirect anyway.

client side caching happening despite version in url

We seems to be having an issue with a css file caching on the client. I generally stop this from causing issue by adding a version number to the file, i.e.
<link href="Default.css?4.31.0.17051" rel="stylesheet" type="text/css">
But in this circumstance this isn't working and I don't understand why.
The version number was incremented last night from 4.30.0.xxxxx to 4.31.0.17051
Some users, and I've seen it myself, are getting a HTTP 304 response. What's strange is if I inspect it using the IE dev tools it shows a HTTP 304, if I fire up fiddler it doesn't show any request at all.
Content caching is not enabled on the server.
Here's the HTTP header if I do a ctrl-f5:
HTTP/1.1 200 OK
Content-Length: 45861
Content-Type: text/css
Last-Modified: Tue, 23 Jul 2013 14:19:40 GMT
Accept-Ranges: bytes
ETag: "0a61aabaf87ce1:bdba"
Vary: Accept-Encoding
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Tue, 30 Jul 2013 16:05:54 GMT
So:
why don't I see this in fiddler? is it not sending the request at all as this question suggests (https://stackoverflow.com/a/8958279/542251)
Why isn't this cache control (i.e. adding the ?4.31.0.17051 to the file) working?
EDIT
I've now touched the file, to update the Last-modified date but it's still not requesting it.
So the page is returning a HTTP 200, so this isn't the page caching as suggested below:
Request:
GET http://www.mysite.com/Agent/Hotel HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: http://www.mysite.com/Agent/Flights
Accept-Language: en-GB
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Accept-Encoding: gzip, deflate
Host: www.mysite.com
Connection: Keep-Alive
Response:
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 53184
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 3.0
Date: Wed, 31 Jul 2013 08:33:25 GMT
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="Default.css?4.31.0.17051" rel="stylesheet" type="text/css" />
.........
As noted in my answer that you cited, the F12 Tools can show a HTTP/304 when the response was really served from the cache. If you don't see the request in Fiddler, it wasn't sent over the network.
Are you sure that the page that refers to the CSS file wasn't pulled from the cache? If it were, then you'd still have the old URL reference. (Look carefully at the CSS request's URL in the F12 tools, as the URL will be accurate even if the "304" was not).
Two points:
- What does "Why isn't this cache control working?" mean? Your HTTP-response headers don't include any Cache-Control directives.
- Changing the Last-Modified date on the server obviously isn't something the client will know about unless it actually issues a Conditional GET request to the server.
So I got a solution but not necessarily an answer.
In the end I updated the tag on the site to:
<link href="Default.css?v=4.31.0.17051" rel="stylesheet" type="text/css">
I'm not sure if adding the v= turning it into a valid querystring was the solution or whether it was just the fact that I altered the URL again solved this issue.
I haven't been able to replicate this issue in staging so I don't really know how or why this started happening.

add curl variable url to output file along with data

Is there a way to add the url you are using in curl to the output file? I have a url string with a variable and each record set that is found, I want to include the url in the output file. URL example i am using is http://history/[1980-2012]/[1-12]/[1-31].hist.htm
If you add -i to your command you'll get the HTTP headers in the output as well with "Location:" on the 2nd line being what you want.
For example, this command:
curl -i -o test.html http://google.com
Generates this output in a file:
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Wed, 07 Mar 2012 21:00:39 GMT
Expires: Fri, 06 Apr 2012 21:00:39 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
here.
</BODY></HTML>

Firebug Shows 301 Moved Permanently

Im using yii framework with tiny mce. When I run my website in localhost it works just fine. But when I upload to the server the editor doesnt show up. when I check in Firebug, it show :
http://www.ptbm.co.id/veevou/assets/dde67fde/tiny_mce/tiny_mce_gzip.php?s=true&diskcache=true&core=t.......
then the status is 301 moved permanently
This is the request code :
// Send request
x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
x.overrideMimeType && x.overrideMimeType('text/javascript');
x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
//x.setRequestHeader('Content-Type', 'text/javascript');
x.send('');
The url correctly pointing to existing file.
Anyone have any idea how to fix this? Thanks
Apparently your server redirects to a URL without the www prefix:
$ curl -I 'http://www.ptbm.co.id/veevou/assets/dde67fde/tiny_mce/tiny_mce_gzip.php?s=true&diskcache=true&core=t'
HTTP/1.1 301 Moved Permanently
Date: Fri, 18 Nov 2011 09:14:48 GMT
Server: Apache
X-Powered-By: PHP/5.3.8
X-Pingback: http://ptbm.co.id/xmlrpc.php
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Last-Modified: Fri, 18 Nov 2011 09:14:49 GMT
Location: http://ptbm.co.id/veevou/assets/dde67fde/tiny_mce/tiny_mce_gzip.php?s=true&diskcache=true&core=t
Content-Type: text/html; charset=UTF-8
You could remove that RewriteRule, or make sure that t.baseUrl does not have any www prefix.
Without more code it is difficult to give any more exact pointers than that.

Resources