http-headers

unable to execute post request with authorization header

限于喜欢 提交于 2019-12-12 04:39:30
问题 I have an issue in angular 4 when I post a request API with Authorization header? addPost(body): Observable<any>{ const url = 'https://xxxxxx'; return this.http.post(URL, body, this.options) .map((res:Response) => { this.data = res.json(); }) } token comes from firebase auth afAuth.auth.currentUser.getIdToken() .then(token => { this.headers = new Headers({ 'Authorization': 'Bearer '+token }); this.headers.append('Content-Type', 'application/json'); this.options = new RequestOptions({ headers:

Cache control not working when hit refresh in the browser

社会主义新天地 提交于 2019-12-12 04:33:11
问题 I'm trying to implement cache control on my application. I've set up the tomcat filter for the all fonts giving a max-age=120. When I request a font for the first time with the cache cleared, the call/response is the following: and as you can see I have the max-age response. Now I expect that if I hit refresh the browser won't send the http request again instead this is what happens: As you can see the second request has a cache-control: max-age=0 value and the response is returned from the

How to setup default “Expect” header for curl

徘徊边缘 提交于 2019-12-12 04:29:55
问题 Can I setup my (CLI) curl to either not set "Expect: 100-continue" or to set it to "Expect: " for my command-line browsing? I've ran into this issue with GCE Load balancer returning 502 for curl because it's confused by Expect: 100 and breaks, and now I have to manually set it up on every request. (Well, not manually, I have aliases for the stuff I test frequently, but that's not the point.) 回答1: You can create a ~/.curlrc file and put your default options in that. Described in the man page

CloudFoundry / Nginx / Grails and the X-Forwarded Header (Missing)

天大地大妈咪最大 提交于 2019-12-12 04:24:29
问题 Using CloudFoundry with Nginx, we're trying to get the X-Forwarded for header out in grails, but we can't seem to do so. It's either blank or the IP address of the Nginx server. We often create sites where users are allowed to vote, and we want to be sure that they only vote once. Therefore, we'd like to use a combination of their network gateway (router) ip address and their X-Forwarded-For (internal) ip address so that we can check if people have already voted without having to block their

Is it possible to send HTTP request using plain socket connection and receive response without headers?

人走茶凉 提交于 2019-12-12 04:02:27
问题 experts I am trying to implement a downloader which handles HTTP protocol, I am able to send HTTP request using the following code: StringBuilder request = new StringBuffer().append("GET ").append(uri.getPath()); if(uri.getQuery() != null) request.append('?').append(uri.getQuery()); request.append(" HTTP/1.1\nHost: ").append(uri.getHost()).append("\nAccept: */*\n\n"); // send the request outputStream.write(request.toString().getBytes("utf-8")); outputStream.flush(); On receiving the response,

cache-control not working without etag

梦想的初衷 提交于 2019-12-12 03:54:26
问题 I am sending the following header in the reponse. "Cache-Control: public, max-age=300" , but still every time I hit refresh I get a 200 response(the request is made to he server again). Same happens if I add the "Expires" header. But if I add a ETag to the headers, then I get 304 on refresh(the request goes to the server, the server prepares the response, then matches the ETag and returns a 204 response). What should I change so that "Cache-Control" header is used and the content is served

Resuming file downloads in Ruby, range header issue

二次信任 提交于 2019-12-12 03:49:08
问题 When setting a range header in Ruby 1.8.7, an additional "X-REMOVED: Range" header is being added, which (seemingly) prevents download resumes from working. size = File.size(local_file) Net::HTTP.start(domain) do |http| headers = { 'Range' => "bytes=#{size}-" } resp = http.get(remote_file, headers) open(local_file, "wb") do |file| file.write(resp.body) end end Header sent: GET /test.zip HTTP/1.1..Host: 192.168.50.1..Accept: */*..X-REMOVED: Range..Range: bytes=481-.... I've also tried using

HTTP “date” header is missing in UnityWebRequest

◇◆丶佛笑我妖孽 提交于 2019-12-12 03:49:05
问题 I am working with Unity3d and am trying to send a GET request to an API that requires the Date request header. However UnityWebRequest does not send it automatically (I have checked with https://requestb.in/) and I cannot set it manually since "date" is one of the protected headers. UnityWebRequest www = UnityWebRequest.Get (fullURL); www.SetRequestHeader("Date", dateTimeString); yield return www.Send(); and I get the following error: ArgumentException: Cannot set Request Header Date - name

check if url exists php

坚强是说给别人听的谎言 提交于 2019-12-12 03:34:33
问题 I'm currently using the following method to check if a url exists $url = 'https://www.facebook.com/a-test-example-232397848665383511'; $headers = @get_headers($url); if(strpos($headers[0],'200')===false){ print('NOT found!'); } else { print('found!'); } This prints NOT found! even though the page clearly resolves when visited. I print the headers and found it is because it returns a 302 . Is there a way of doing a strpos to test for all possible header values that resolve? Current output of

Why cant i extract the cookie from the header? AngularJS + dJango

僤鯓⒐⒋嵵緔 提交于 2019-12-12 03:33:14
问题 Im trying to get the cookie value from the header but it returns undefined. Using $cookies module. Service: socialMarkt.factory('homeService', ['$http', function($http){ var apiAddress = "http://server.apigoeshere.io:8000/s/first/"; return { getEvents : function(params) { return $http.get(apiAddress, {params}); } } }]); Controller: homeService.getEvents({"page":"1"}).then( function(response){ $scope.events = response.data.events; console.log($cookies.get('csrftoken')) //undefined; });