http-headers

Angular interceptors and CORS

廉价感情. 提交于 2019-12-10 13:46:04
问题 I am trying to write an interceptor to add a token to all HTTP requests using Angular. I am using roughly the recipe given here - https://thinkster.io/interceptors So the code uses http module factory and a tokenInterceptor() function. I can successfully add a token as a header to the request - but now when it passes through the interceptor, it gets blocked by some kind of CORS blocking mechanism. I get this error in chrome console - XMLHttpRequest cannot load http://127.0.0.1:/. Response to

Dynamically Create and Download Doc File

ε祈祈猫儿з 提交于 2019-12-10 13:45:30
问题 So I'm trying to both dynamically create a .doc file and have the user download it when he clicks a button. These are the headers i found to download a file header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); And these are the headers i found to make a a word document header('Content-type: application/vnd.ms-word'); header('Content-Disposition: attachment; Filename='.$myFile); I'm just having a hard time just fitting the picture together because

Content-Disposition Filename not working on IE

核能气质少年 提交于 2019-12-10 13:40:13
问题 I am working on an asp.net/c# web application that allows users to view and download PDF files. When I am clicking on a file, I get to view that in the PDF reader available in the browser, and when I save it, the file should be saved with the name that I have passed via headers. But this is not the behavior in IE7 & IE8 FileInfo f = new FileInfo(FileName); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "inline; filename=" + f.Name) When I click to save a

Can I set the “HTML” Title of a PDF file served by my Apache Web server

风流意气都作罢 提交于 2019-12-10 13:39:06
问题 I have HTML pages that contain <a> tags with hrefs that point to PDF files. My Apache Web server serves them just fine, but the title, as shown in the Browser history, is of the file name. I would like to be able to set that title. Perhaps there's a Header than can be set? I don't want to write a script to serve the files as the server can handle Content-Encoding negotiation (e.g., for gzip), and do flow control, none of such do I want to re-create. 回答1: Here is an http header you can set.

How can I read the content of the content-disposition header?

偶尔善良 提交于 2019-12-10 13:15:03
问题 TEMPORARY SOLVED: InputStream closed in Apache FileUpload API I want to read the content of the content-disposition header but request.getHeader ("content-disposition") always return null and request.getHeader ("content-type") only returns the first line, like this multipart/form-data; boundary=AaB03x . Supose I receive the following header: Content-Type: multipart/form-data; boundary=AaB03x --AaB03x Content-Disposition: form-data; name="submit-name" Larry --AaB03x Content-Disposition: form

Azure webrole excesive headers

泄露秘密 提交于 2019-12-10 12:18:54
问题 I have a website running in Azure Web Roles. I tested the site against asafaweb.com and got an "Excessive Headers" warning. Basically Azure sends out the IIS version and the .net version as part of the header. There is plenty of information on how to turn these headers off in IIS, but how do I turn them off in Azure? 回答1: This is what I use in most projects to hide these headers: Global.asax.cs (only applies to MVC projects) protected void Application_Start() { MvcHandler

PHP : How to submit “JSON” via the PUT method?

依然范特西╮ 提交于 2019-12-10 11:51:35
问题 I'm making (and testing) my small PHP API. Both GET/POST methods are all fine while submitting the JSON as data-type. Problem in PUT I cannot submit the JSON data via PUT method. When i do, the Server-side got empty data. But when i DO NOT use json as data-type, (and just use the plain text data), then i can receive and parse the data, successfully . <----(( This is something weird! )) Here are my tested cases. Client Side (Submissions) (Submit via PHP) submit.php: $data = array("fruit"=>

Why does php's file_get_contents incorrectly retrieve json files from xkcd?

依然范特西╮ 提交于 2019-12-10 11:49:46
问题 In writing a PHP script to download xkcd comics, i incurred errors when trying to get specific comics (as opposed to the latest one). Specifically, pointing file_get_contents at the following url: xkcd.com/$COMIC_NUM/info.0.json inexplicably retrieved the xhtml version of the comic's page on xkcd.com, and not a JSON file. However, if i request the exact same url in my browser, the correct JSON file is downloaded. I'm not sure why this is happening, but i suspect it has something to do with

HttpHeader isn't correctly sent

为君一笑 提交于 2019-12-10 11:48:59
问题 I am coding according to this guide: https://angular.io/guide/http#configuring-other-parts-of-the-request. My code is the following: loadMenuOptions(): void { console.log('this.currentApiKey |' + this.currentApiKey); let header = new HttpHeaders(); header = header.set('api-key', this.currentApiKey); this.commonService. getMenuOptions(MENU_OPTIONS, header).subscribe(respuesta => this.setMenuOptions(respuesta)); } The following code is when I send this object to the server: getMenuOptions