http-headers

Basic Authentication over redirection

∥☆過路亽.° 提交于 2019-12-11 01:39:09
问题 I have a webservice that needs a Basic Authentication header. However, when I call it using var header = "Authorization: Basic " + CreateBasicHttpAuthenticationHeader(login, password); webRequest.Headers.Add(header); var webResponse = (HttpWebResponse)webRequest.GetResponse(); It returns a 303 - See Other: POST https://myservice/rates HTTP/1.1 Authorization: Basic QXZ...NjY= Content-Type: application/x-content X-API-Version: 1.1 If-Unmodified-Since: Mon, 23 Sep 2013 08:32:27 GMT User-Agent:

Origin and Host headers for same domain requests

夙愿已清 提交于 2019-12-11 01:38:35
问题 We have RESTful JSON endpoints serving AJAX requests, with the desire to support Cross Origin Resource Sharing. We are locking things down to ensure that we don't have to worry about Cross Site Request Forgery (CSRF) attacks. Part of the approach we are using is to check for the presence of a Origin header and verify that it is included in a whitelist of approved Origins. However, we have noticed that some browsers (Chrome and Safari among them) include the Origin header with AJAX POST

Will duplicate “Access-Control-Allow-Origin: *” headers break CORS?

眉间皱痕 提交于 2019-12-11 01:11:58
问题 So we have an http resource that serves up JSON. It adds an Access-Control-Allow-Origin: * flag. So this can be loaded with CORS... except (so I'm told) there's some IE9 quirk that means this still won't work in IE9, but it would work if this were an https resource. So we set up an existing https proxy to include this resource. Only that https resource was ALSO adding the Access-Control-Allow-Origin: * header, so the response contains TWO such headers. And this seems not to work at all.

ReST low latency - how should I reply to a GET while an upload is pending?

和自甴很熟 提交于 2019-12-11 00:42:22
问题 I am designing a ReST API which follows the basic CRUD pattern. My API can receive a request to update a resource which may take a short time to process. Ideally I would like to inform clients that a new version is about to be available and that there is some uncertainty over when the version I have cached actually expires. So the process I intend to use something like this (improvements welcome): client: GET /some/item myapi: 200 OK last-modified: time-stamp-of-v1 etag: some-hash-relating-to

Prevent a SOAP message from being sent with content-type as “multipart/related”

谁说胖子不能爱 提交于 2019-12-10 23:43:25
问题 I am sending a SOAP message from a webservice client (code was generated by IBM RAD 7.5) to a host, and it with a webservice fault and a message that in the hosts' log reads as "content not allowed in prolog". When I send the same content with SoapUI or a simple apache HttpClient test client, the message is received and processed by the host, and I get the expected response. As far as I can tell, the difference is in the HTTP headers that are being sent. RAD-generated client: POST /ws

How to know if my Custom HTTP headers are being passed?

风流意气都作罢 提交于 2019-12-10 23:39:28
问题 So, I have been struggling with passing custom HTTP header for some time now. I am creating a script (Python) to Open a URL with Custom headers like {'Referer': 'https://google.com', 'X-Forwarded-For': '47.29.76.109', 'User-Agent': 'Mozilla/5.0 (Linux; Android 7.1.1; CPH1723 Build/N6F26Q; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Mobile Safari/537.36', 'existing_proxy_port_to_use': '8090'} I have been using BrowserMob-Proxy for this but I am unable to see the

How do i send a POST request without Transfer Encoding:chunked from Jersey ReST Client 2.22.2

99封情书 提交于 2019-12-10 23:27:30
问题 When i send a POST request through Jersey ReST client it's automatically using Header transfer-encoding: [chunked] . Is there any way to force use of content-length: instead of transfer-encoding.? WebTarget webTarget = client.target(connection.getServerUrl()); Invocation.Builder builder = webTarget.request(MediaType.APPLICATION_XML); Response response = builder.post(Entity.xml(requestBroker)); After adding Content-Length property too the behavior is same WebTarget webTarget = client.target

Differentiate nginx behaviour depending on URL

做~自己de王妃 提交于 2019-12-10 22:26:26
问题 I have a Django application and I use nginx to serve static content. Unfortunately, all registered MIME types get displayed in client browser, while I would like to give an ability to download the same content , along with usual behaviour. Say, I have JPEG file under /media/images/image01.jpg and I want that nginx serves this file in usual way, with standard image/jpeg header, but additionally I want the same image to be served by nginx with content-disposition: attachment (effectively

ZF2 - how to correctly set headers?

不羁的心 提交于 2019-12-10 21:52:47
问题 I have problem with setting headers in ZF2. My code looks like this: public function xmlAction() { $headers = new \Zend\Http\Headers(); $headers->clearHeaders(); $headers->addHeaderLine('Content-type', 'application/xml'); echo $file; // xml file content exit; } But headers are still text/html. I can set the proper header with: header("Content-type: application/xml"); but I would like to do it with Zend Framework. Why code above doesn't work? 回答1: What you are doing is setting headers in a ZF2

PHP forces PDF file download even though I'm using Content-Disposition: inline

最后都变了- 提交于 2019-12-10 21:33:17
问题 I'm trying to display a PDF in the browser if possible--and I know I can do this in Chrome, which is what I'm testing in. The trouble is, every time I try, it prompts a download instead. I'm using PHP sessions, so I know there are some extraneous headers being sent, so I called header_remove() to reset everything. I call this function to show the PDF: <?php // For demonstrative purposes session_start(); if (!isset($_SESSION['auth'])) { header('Location: login.php'); die; } /* * void viewPDF