IE 11 Missing Request Headers - ie11-developer-tools

On a GET XHR request, there are no Request Headers in the IE 11 console. The headers do exist in Chrome and Firefox.
How do I send headers with a GET request?

When IE 11 caches a request there are no headers. I had to add a query param to the request (?d=${Date.Now()}) to ensure that the request was not being cached.

Related

grcp request payload format

I'm trying to log in into a site which requires grcp content-type using requests. I alrady have a HTTP 2 client, but I don't know how body of my post request should look like.
When I'm trying to simply copy request as a curl from chrome network tab, request body looks like this:
%äEMAIL"PASSWORD(0
When I'm trying to request site with same body as I copied from chrome tab, I'mm getting response with this headers:
Grpc-Message: grpc: received message larger than max (218767392 vs. 4194304)
Grpc-Status: 8
I'm sure It's becouse wrong payload format
If anybody knows how can I pass data in request plase help.
If you're trying to send a one-off gRPC request, https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md would be helpful to know as to how to construct a message. Otherwise, using gRPC clients (https://github.com/grpc/grpc) would make more sense.

Expose response header Nodejs

Getting response headers and I want to expose one of the header from it. For eg, x-cloud-trace-context this header should visible in the browser response body.
I tried with exposedHeaders using CORS but still not getting it on the browser and this leads to preflight mode.
Any help would be highly appreciated.

Browser doesn't cache http response

I have a http request /api/speakers/ and I want it to be cached by browser.
So I added Cache-Control to the request headers:
headers: {
'Cache-Control': 'public, must-revalidate, max-age=86400'
}
cache-control appears in request headers, but every time it requests it gets new data from response. I am testing without refreshing page, so that is not the problem.
What am I doing wrong? How to tell browser to cache request responses and not to request it next one day.
I thought that Cache-control should be sent by frontend, so the browser understands it and caches requests. It turned out that backend sends headers in response so browser can cache requests. In my case, backend written in Django used cache_page and now browser caches everything perfectly.

How can I get the authorization from the site using requests Python

there is a site I want to send some requests to, but it asks me the authorization when sending a post-type request.
This is the form of authorization:
The problem is that it is inside the Request Headers, and when I do this process:
r = requests.get("https://www.examplesite.com")
print(r.headers)
The Response Headers data is returned, but I want to get the authorization from the request headers ..
how it would be ?
this response headers ..
and this request heades, I want to get it..
If the authorization is in the request header, you need to set it when you are forming the request, before you send it to the intended host.
import requests
headers = { "authorization": "random-gibberish-that-is-the-auth" }
request = requests.post("https://www.examplesite.com", headers=headers)
This means, you will need to have an authorization key that you can assign to the authorization header prior to making your request.

Redirect in Flask - pass a custom header in the request to target

TLDR; How do I set a custom HTTP request header in redirect?
Below code redirects to an external service but fails to pass 'Authorization' request header to target. I can see the header in response before redirect happens - can it be forwarded somehow?
#app.route('/external_page')
def external_page():
if not request.cookies.get('id_token'):
return flask.redirect(flask.url_for('login',_external=True,_scheme=SCHEME))
response = flask.redirect(flask.url_for('https://external_service_url/v1/ui'))
response.headers['Authorization'] = 'token_id'
return response
Answer:
It's not possible, in HTTP and not in any framework.
The only way for a site to instruct a browser to issue an HTTP request
with a custom header is to use Javascript and the XMLHttpRequest
object. And it needs CORS implemented on the target server to allow
such ajax requests.
Source: Redirect to page and send custom HTTP headers
It's not possible
See Redirect to page and send custom HTTP headers
The only way for a site to instruct a browser to issue an HTTP request
with a custom header is to use Javascript and the XMLHttpRequest
object. And it needs CORS implemented on the target server to allow
such ajax requests.

Resources