http-headers

Wordpress > Scripting the 404.php to send 201 host header on specific 404 requests

In my wordpress site, I have a specific condition that triggers a 404 in which I want to handle as a "404 exception" (< there's probably a better term I could use but hopefully it conveys the spirit of what I'm trying to do :) For example, the page mysite.com/site-map does not exist in my site, however, I have a link called "Site Map" ...

How can I tell when HTTP Headers have been sent in an ASP.NET application?

Long story short, I have an ASP.NET application I'm trying to debug and at some point, in very particular circumstances, the application will throw exceptions at a Response.Redirect() stating: "Cannot redirect after HTTP headers have been sent." Which I more or less get, except that I cannot figure out where the headers were sent. I...

Why is Rack::Cache not hitting cache when etag matches?

Starting with no cache on server or client FIRST REQUEST GET /post/1 HTTP/1.1 HTTP/1.1 200 OK Date: Fri, 05 Mar 2010 09:05:46 GMT Last-Modified: Thu, 04 Mar 2010 21:00:08 GMT X-Rack-Cache: miss Etag: "c226165d5817af7c91592dab0bc0ac63" Cache-Control: max-age=3600, public The Cache is missed and Rails gets hit and queries the database...

Should I set the Cache-Control header when serving up files? Or not?

I'm serving up some files via an HTTPModule in asp.net. I want to know if there are any benefits to setting, or not setting, the Cache-Control header to something (like no-cache)? Edit: The reason I'm curious about this is because we ran in to a problem where serving up office documents over an SSL session in IE results in an error (wi...

x-forward-for on tomcat 5.5.25

I am working on getting x-forward-for to work on tomcat 5.5.25, I know a patch has gone out for Tomcat 6.0.24, but we can't upgrade our tomcat version right now. So I did some digging into the Tomcat 6.0.24 and found the RemoteIPValve.class(the class that implements x-forward-for) is located in catalina.jar. My question is has anybody ...

HTTP Headers for Unknown Content-Length

I am currently trying to stream content out to the web after a trans-coding process. This usually works fine by writing binary out to my web stream, but some browsers (specifically IE7, IE8) do not like not having the Content-Length defined in the HTTP header. I believe that "valid" headers are supposed to have this set. What is the pro...

Add http headers to Cassini via config

Our asp.net web site is currently deployed to an IIS7 server. We are setting some http headers via the config file such as this: <httpProtocol> <customHeaders> <remove name="X-UA-Compatible" /> <add name="X-UA-Compatible" value="IE=EmulateIE7" /> </customHeaders> </httpProtocol> This works great for myself as I host my per...

Optimistic locking & the HTTP If-Match header

What are your experiences on using If-Match to implement an optimistic locking scheme on a web service? To simplify things, let's say we're building a simple CMS, consisting solely on "pages", each having just a body. If two users begin editing the same page simultaneously, then only the changes made by the user who were last to save ar...

HTTP HEAD method and pipelining

I'm writing some code that parses HTTP requests and responses, but it may not see both sides of every conversation. The HTTP RFC states that a HEAD request should cause exactly the same response as GET except that a message body is not sent. This seems to imply that a Content-Length header would be included. If HTTP Pipelining is being...

Headers to set for AJAX calls in a custom webserver

I'm writing a custom web server. When I enter the URL of my server in the browser, I get the sample text I write out to the socket in my browser correctly. This is the HTTP response that I write: HTTP/1.1 200 OK\r\n Server: My Server\r\n Date: Blah\r\n Content-Type: text/plain\r\n \r\n This is some sample text. This appears in my browse...

Asking browsers to cache as aggressively as possible

This is about a web app that serves images. Since the same request will always return the same image, I want the accessing browsers to cache the images as aggressively as possible. I pretty much want to tell the browser Here's your image. Go ahead and keep it; it's really not going to change for the next couple of days. No need to co...

Does Flash comply with HTTP Location header?

Hello, does Flash comply with HTTP Location headers? For example, if Flash makes a POST request to http://www.example.org/mail and it returns Location: http://www.example.org/mail/1.xml, will Flash return the data in in 1.xml upon completing the POST request? ...

Last-Modified in http header

I request a website header, however, there is not Last-Modified info in this http header. I wanna creat a site map and get each file's date on the server. Don't understand why there is not this info for some websites. How did some softwares, such as Xenu, get the file's date. ...

How do you initiate/force a download for files that reside externally in PHP or other language?

If you have images or other files that reside externally, how do force the browser to download the link when a user click on it? The use of "Content-disposition: attachment;" header would do that, but it is not working for files that resides externally without reading and importing the file locally. ...

How Can I Determine if HTTP Requests/Responses are compressed in IE7?

I'm trying to use Fiddler (v2.2.2.0) to see if HTTP traffic through IE7 is being compressed. I'm not seeing Accept-Encoding or Content-Encoding request/response headers being sent/returned and I do not need to decode the response data once it's arrived, which leads me to believe that the responses are NOT coming back compressed. Howeve...

Does the `Expires` HTTP header needs to be consistent across multiple cold-cache requests?

I'm implementing a custom web server of a kind. And am looking into adding an Expires header support. However, I'm a little unsure of how exactly to implement it. If multiple cold-cache requests are being made to the same unchanged resource on the server and the server returned different Expires header (say it uses relative time to calc...

How to remove HTTP specific headers in Javascript

Is it possible to, before sending a http message, remove some specific http headers using javascript / XmlHttpRequest ? I'm using a proprietary browser, so there's no way to do it using browser specific solution. For example, I want to remove the header 'Authorization' before send the message POST /social/rpc?oauth_version=1.0& ... HT...

Specifying locale for http request/response

I have a ReSTful web service which needs to parse locale-sensitive data from the request. This data could either be in an XML body or part of the query string. Is there any acepted way of determining which locale the data is being sent in (and by extension the locale in which the response should be sent)? One option is simply to specify...

PHP Server Side Post to Recreate Replace Secure Single Sign On

I host and intranet and manager several Single Sign Ons for outside websites. We have always done this through some sort of hidden form. Example <form method="post" action="example.php"> <input type="hidden" value="user" name="user" /> <input type="hidden" value="password" name="password" /> </form> We can then have a javascript ...

Excel formula for variable fields

I am looking for a simple formula to do the calculation on two fields that are variable, for e.g., c1 has 100 and c3 has 150 and I want to calculate an increase/decrease percentage, but the trick is the cell values change every month. How do I put the formula to cater for such variation. Appreciate your help. Regards ...