Questions tagged [http-headers]

HTTP header fields are components of the message header of requests and responses in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction.

HTTP header fields are components of the message header of requests and responses in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction.

Refer to RFC 2616

624 questions
20
votes
1 answer

How can I remove HTTP headers with .htaccess in Apache?

I have a website that is sending out "cache-control" and "pragma" HTTP headers for PHP requests. I'm not doing that in the code, so I'm assuming it's some kind of Apache configuration, as suggested by this question (you don't really need to go there…
Daniel Magliola
  • 1,432
  • 9
  • 20
  • 33
18
votes
4 answers

Set header in apache if it doesn't already exist

I have a proxy that is injecting some headers but I want to modify it so it only sets the headers if they are not already present: RequestHeader set MY_HEADER "value" ProxyPass http://127.0.0.1:8000/api …
Hobozilla
  • 324
  • 1
  • 3
  • 8
17
votes
2 answers

How can I add in apache referrer policy header?

I'm not sure how can I add referrer policy header to my virtual host configuration file. Let's say that I want to add something like this Referrer-Header: same-origin, should it be in this way: Header set Referrer-Header: same-origin
tigun
  • 173
  • 1
  • 1
  • 4
17
votes
5 answers

Referer is passed from HTTPS to HTTP in some cases... How?

In theory browsers do not pass on referer information from HTTPS to HTTP sites. And in my experience this has always been true. But I just found an exception, and I want to understand why it works so I can use it as well. Search for "what is my…
ravisorg
  • 501
  • 1
  • 3
  • 8
16
votes
3 answers

Is there any reason to keep the "Server" response header in Apache

My server responds with Server: Apache/2.2.15 (CentOS) to all requests. I guess that this gives away my server architecture making it easier to hack attempts. Is this ever useful to a web browser? Should I keep it on?
Nic Cottrell
  • 1,302
  • 16
  • 32
16
votes
4 answers

nginx passing back custom header

I have the following example location / { proxy_read_timeout 2000; proxy_next_upstream error; proxy_set_header X-Real-IP $remote_addr; proxy_set_header…
Mike
  • 22,310
  • 7
  • 56
  • 79
15
votes
3 answers

NGINX is not forwarding a header value when using proxy_pass

I have the following setup and configured to send all /api requests to a different server: location /api { proxy_pass https://myapp.herokuapp.com; rewrite ^/api/(.*) /$1 break; } My app sends a…
dallasclark
  • 771
  • 2
  • 7
  • 17
14
votes
5 answers

Running an API, if I correct a content-type header will that break things for customers?

We're running an API with quite a few people using it. Due to some legacy clumsiness on my part, one of the endpoints is returning the wrong content-type header, js when it should be json. My question is, if we fix this by swapping to return the…
Harry Wood
  • 301
  • 3
  • 9
14
votes
1 answer

How to configure nginx so it works with Express?

I'm trying to configure nginx so it proxy_pass requests to my node apps. Question on StackOverflow got many upvotes: https://stackoverflow.com/questions/5009324/node-js-nginx-and-now and I'm using config from there. (but since question is about…
Mars Robertson
  • 243
  • 1
  • 2
  • 6
14
votes
2 answers

Nginx proxy caching - how to check if it is working?

I have set up my nginx.conf file to use proxy caching from tutorials I have found online. Now I am trying to figure out how to check if it is actually working. I've read somewhere that adding add_header X-Cache-Status $upstream_cache_status; to the…
still.Learning
  • 143
  • 1
  • 1
  • 4
14
votes
4 answers

RequestHeader with Apache environment variable

I have Apache set up as a load balancer. I wanted to make apache set the X-Forwarded-Proto header, but this doesn't work: RequestHeader set X-Forwarded-Proto "%{SERVER_PROTOCOL}e" The header gets set to null. Any idea why?
John Crenshaw
  • 161
  • 1
  • 1
  • 5
14
votes
3 answers

How can I log the response header and body in apache?

I need to determine whether the server (Apache 2) is returning the full contents of a page along with its correct header or not. I have a PHP-script that is executed successfully, but the browser is getting only half of the html content, it's simply…
acme
  • 677
  • 1
  • 8
  • 13
13
votes
1 answer

Add a custom header to ProxyPass requests

I have a simple apache vhost: ServerName hello.local ProxyPass / http://localhost:8810/ ProxyPassReverse / http://localhost:8810/ All request to hello.local are proxyed to http://localhost:8810/. What I'd…
Simon
  • 636
  • 1
  • 5
  • 13
13
votes
5 answers

Why does Nginx remove Content-Length header for chunked content?

I use nginx 1.2.3 to proxy to a script: proxy_set_header Host $host; proxy_pass http://127.0.0.1:8880; proxy_buffering off; proxy_read_timeout 300s; gzip off; The scripts sends both Transfer-encoding: chunked and Content-Length: 251: HTTP/1.0 307…
Julien
  • 1,038
  • 1
  • 13
  • 24
12
votes
2 answers

How do I set proper Headers for JSON in Apache?

I have an Apache server which is serving out static JSON files. The Content Type is correctly being represented in the header with an Content-Type: application/json header. How do I add the correct Charset to the header? I have the following line in…
Devdatta Tengshe
  • 583
  • 2
  • 4
  • 13
1
2
3
41 42