http-headers

Can't use custom Request Headers on AWS API Gateway with CORS

匆匆过客 提交于 2020-01-02 09:43:34
问题 I have created and deployed an AWS API Gateway resource with the following structure including a custom HTTP Request Header 'X-header' dev (stage) /echo (resource) POST (method) Method Request - Headers: X-header OPTIONS (method) Method Request - Headers: X-header When I POST to the endpoint from Chrome, I get the following error. XMLHttpRequest cannot load https://fxxxx.execute-api.us-west-2.amazonaws.com/dev/echo. Request header field X-header is not allowed by Access-Control-Allow-Headers

Content-Type with charset only

喜欢而已 提交于 2020-01-02 08:16:48
问题 I came across this interesting header: Content-Type: charset=utf-8 Set HTTP header to UTF-8 using PHP The answerer says that this syntax is defined by RFC 2616, but I am not seeing it in the provided link. Is this valid syntax, and if so where specifically is this defined? 回答1: The production in RFC 2616 for the Content-Type header is this: Content-Type = "Content-Type" ":" media-type And the media-type production is this: media-type = type "/" subtype *( ";" parameter ) type = token subtype

How to send custom HTTP header in response?

大城市里の小女人 提交于 2020-01-02 05:57:27
问题 I want to send json data in my HTTP Header. I am using Codeigniter PHP, so I did this in my controller: header('Content-Type: application/json');' This is my code: $request = array( 'request' => $_GET['request'], 'device_id' => $_GET['device_id'], 'launch_date'=> $_GET['launch_date'], 'allowed_hours'=>$_GET['allowed_hours'], 'site_id'=>$_GET['site_id'], 'product'=>$_GET['product'], 'software_version'=>$_GET['software_version'], 'platform_os'=>$_GET['platform_os'], 'platform'=>$_GET['platform'

Extracting Information from a Tuple (Python)

萝らか妹 提交于 2020-01-02 04:49:05
问题 I'm currently using the httplib library in Python 2.7 to obtain some headers from a website to establish a) the filesize of a download and b) the last modified date of the file. I've used some online tools and these details do exist. I'm currently scripting my Python code and it appears to work correctly bringing back the required information. Nonetheless, the response containing the header information is a list containing a number of tuples. A sample of the response is below:- [('content

Force Browser to cache images

一世执手 提交于 2020-01-02 03:53:06
问题 I am generating the images and want browser to cache them forever, but instead browser never cache them at all. This is my php code header('Content-type:'.$file->content_type); header('Expires: Thu, 15 Apr '.(date('Y')+10).' 20:00:00 GMT'); header('Content-Disposition: attachment; filename="'.$file->file_name.'"'); echo(file_get_contents($model_files->files_path.$file->md5.$model_files->seprator.$file->file_name)); and these are the response headers which i keep getting in browser. Date: Thu,

PHP: close output stream

馋奶兔 提交于 2020-01-02 03:37:11
问题 Is it possible to close the output stream of a PHP script? I have a script which needs to do some post processing, but during and after the post processing it won't send any data to the client anymore, so I'd like to close the connection before the post processing. Edit: In my application I have a cache which needs to be rebuild every now and then. However, I don't want to slow a user down. What I want is to determine at the end of the script if the cache needs to be rebuild. So I want to

Is there a size limit for HTTP response headers on Google App Engine?

大城市里の小女人 提交于 2020-01-02 02:53:08
问题 I was trying to run a profiler on some handler code up on appspot and was looking for a way to show the pstats output without writing directly to the response body (which is problematic for handlers responding with structured data such as JSON). I decided to try writing the output to the response header, and added some js to my html-rendering handlers that could parse the header and console.log() it (turned out to be pretty simple and convenient to work with). For the non-html rendering

HTTP: How should I respond to “Range: bytes=” when Range is unsupported?

两盒软妹~` 提交于 2020-01-02 02:00:11
问题 What is the correct response to a GET request with the header field Range: bytes=278528- if Range is not supported? Reading the HTTP header definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) i think i should at least set: Accept-Ranges: none , but it clearly states that Clients MAY generate byte-range requests without having received this header for the resource involved. So, if a client requests a range, should I: Reply with the whole file from byte 0? Reply with some

what characters are allowed in HTTP header values?

我是研究僧i 提交于 2020-01-02 00:56:09
问题 After studying HTTP/1.1 standard, specifically page 31 and related I came to conclusion that any 8-bit octet can be present in HTTP header value. I.e. any character with code from [0,255] range. And yet HTTP servers I tried refuse to take anything with code > 127 (or most US-ASCII non-printable chars). Here is dried out excerpt of grammar used in standard: message-header = field-name ":" [ field-value ] field-name = token field-value = *( field-content | LWS ) field-content = <the OCTETs

Does it make sense to have max-age and s-maxage in the Cache-Control HTTP header?

北城余情 提交于 2020-01-01 23:11:14
问题 Considering that max-age applies to all the caches, and s-maxage only applies to shared caches (proxy and gateway cache).... Does it make sense to use both directives in a non-expirable and public page? Controller pseudo-code: w = Response(); w.setPublic(); w.setMaxAge("1 year"); w.setShareMaxAge("1 year"); return w; 回答1: From HTTP Header Field Definitions: 14.9.3 Modifications of the Basic Expiration Mechanism ... s-maxage If a response includes an s-maxage directive, then for a shared cache