Authentication issues with WWW-Authenticate: Negotiate

Putting this information here for future readers’ benefit. 401 (Unauthorized) response header -> Request authentication header Here are several WWW-Authenticate response headers. (The full list is at IANA: HTTP Authentication Schemes.) WWW-Authenticate: Basic-> Authorization: Basic + token – Use for basic authentication WWW-Authenticate: NTLM-> Authorization: NTLM + token (2 challenges) WWW-Authenticate: Negotiate -> Authorization: Negotiate … Read more

How to configure X-Frame-Options in Django to allow iframe embedding of one view?

You are going in the right direction, but exact decorator which you will need to achieve this is ‘xframe_options_exempt’. from django.http import HttpResponse from django.views.decorators.clickjacking import xframe_options_exempt @xframe_options_exempt def ok_to_load_in_a_frame(request): return HttpResponse(“This page is safe to load in a frame on any site.”) PS: DJango 1.6 is no longer supported. It is good time to … Read more

Add a custom response header in ApiController

You can explicitly add custom headers in a method like so: [HttpGet] [Route(“home/students”)] public HttpResponseMessage GetStudents() { // Get students from Database // Create the response var response = Request.CreateResponse(HttpStatusCode.OK, students); // Set headers for paging response.Headers.Add(“X-Students-Total-Count”, students.Count()); return response; } For more information read this article: http://www.jerriepelser.com/blog/paging-in-aspnet-webapi-http-headers/

JMeter Alter HTTP Headers During Test

You can dynamically construct your authorization header using Beanshell PreProcessor as follows: Add empty HTTP Header Manager as a child of your request which requires authorization Add Beanshell PreProcessor as a child of the same request with the following code: import org.apache.jmeter.protocol.http.control.Header; sampler.getHeaderManager().add(new Header(“Authorization”,”Bearer ” + vars.get(“BEARER”))); This will construct fully dynamic header using BEARER … Read more

$http Auth Headers in AngularJS

You’re mixing the use cases; instantiated services ($http) cannot be used in the config phase, while providers won’t work in run blocks. From the module docs: Configuration blocks – […] Only providers and constants can be injected into configuration blocks. This is to prevent accidental instantiation of services before they have been fully configured. Run … Read more

HTTP post XML data in C#

In General: An example of an easy way to post XML data and get the response (as a string) would be the following function: public string postXMLData(string destinationUrl, string requestXml) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(destinationUrl); byte[] bytes; bytes = System.Text.Encoding.ASCII.GetBytes(requestXml); request.ContentType = “text/xml; encoding=’utf-8′”; request.ContentLength = bytes.Length; request.Method = “POST”; Stream requestStream = request.GetRequestStream(); requestStream.Write(bytes, … Read more

NGinx $proxy_add_x_forwarded_for and real_ip_header

The $proxy_add_x_forwarded_for is equal to $http_x_forwarded_for,$remote_addr, and the $remote_addr variable will be changed when http_realip_module is used. So you will not get the last proxy addr in that header. Changing the order of directives won’t have an effect because nginx configuration is declarative. When http_realip_module is used, the $realip_remote_addr variable (nginx >= 1.9.7) can be … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)