Menu
  • HOME
  • TAGS

cache-control:max-age=0 in http request

Tag: http,cache-control

I have one question

suppose in each http request there is "cache-control:max-age=0 in http request",so each request will go all the way to origin web server. Does it mean CDN is not usefuly anymore if the request is this?

Best How To :

By setting the max-age to 0, you effectively expire your page in your CDN edge cache immediately. Therefore, your CDN always hit your origin and render the CDN useless as you suggested.

Noticed from your other question that you are using Akamai. If so, then you can use the Edge-Control header to override your cache-control if you don't have direct control over that value, but still want to be able to leverage CDN functionality.

Custom HTTP Header or cookies? how custom authentication/authorization helps in CSRF?

javascript,http,cors,csrf

When authentication is based on cookie, every fired request from the client will be authenticated. Whether it is a "good" - intended by application, or "bad - as a result of CSRF attack. Browser will always blindly add cookie to every request. When authentication is based, for instance, on bearer...

Mocking/Testing HTTP Get Request

java,unit-testing,http,junit,mockito

Part of the problem is that you're not breaking things down into interfaces. You need to wrap getContent into an interface and provide a concrete class implementing the interface. This concrete class will then need to be passed into any class that uses the original getContent. (This is essentially dependency...

How to make a jax-rs end point accept any type of http request?

http,jax-rs,resteasy

Short answer: Yes, you can annotate a method with @OPTIONS, @HEAD, @GET, @POST, @PUT, @DELETE and the resource method should be called on all of these methods. Long answer: You should not! Every HTTP method has it's semantic. A @GET is a 'safe' method because it is intended for reading...

Handling POST request via Socket in Java

java,sockets,http,post,request

The code you have shown is not the correct way to read HTTP requests. First off, Java has its own HttpServer and HttpsServer classes. You should consider using them. Otherwise, you have to implement the HTTP protocol manually. You need to read the input line-by-line until you reach an empty...

Which Http error/status code is the appropriate?

javascript,http

Both scenarios that you described are server errors. Regardless if it was a DB operation that fails or you server-side code didn't handle an error (unhandled error). Therefore, for the Front-end point of view, A server error has occurred (500 error status). Now, differentiating an custom application error from an...

AngularJS $http request using forEach inside of Controller

angularjs,http,foreach

You are trying to log $scope.infos without waiting until requests complete and push loaded response data to array. The answer here is using Promises for providing callback to fire once all requests resolve and push their respective data: app.controller('mainController', function($scope, $http, $q) { var url = 'https://api.twitch.tv/kraken/channels/'; $scope.channels = ["freecodecamp",...

How can I capture data send to a webserver/website?

http

Try Fiddler. It acts as a system-wide proxy and captures all http requests and provides a way to inspect them.

ASP.net HTTP Post when auto-incrementing row Id

sql,asp.net,asp.net-mvc,http

That exception means your model classes do not match with the database tables exactly. If you are in a database-first scenario (you design the database and then you make the classes) then you should add an "ADO.NET Entity Data Model" to your project and select the Code First from Database...

how can I create a URL/site to send a HTTP 204 or HTTP 403 response?

objective-c,http,servlets,post,ios7

You certainly can implement your own web service to return those HTTP responses. For testing your app you can use services like httpbin.org For example: To get a 403 response, simply send a request to http://httpbin.org/status/403 ...

Purpose of Pseudo/Colon Header Fields

http,networking,http-headers,protocols,http2

The purpose of the pseudo header fields was to unify the way the request/response information was carried in SPDY and later in HTTP/2 (which is based on SPDY). When SPDY was designed (but also HTTP/2) there was a need to transport request or response information that is formatted in different...

RestSharp - How do I get the numerical http response code?

c#,http,restsharp

Simply grab the ResponseCode property off of the RestResponse object and cast the enum value to int. RestResponse response = client.Execute(request); HttpStatusCode statusCode = response.StatusCode; int numericStatusCode = (int)statusCode; ...

Mule: Migrating to the New HTTP Connector

http,mule,cxf

The solution is: wrap your element into a processor-chain As follows: <processor-chain> <cxf:jaxws-client serviceClass="com.acme.orders.v2_0.IOrderServiceBean" port="OrderServiceBean_v2_0Port" operation="getApprovedOrderOp" /> <http:request config-ref="http.request.config" path="acme-services/OrderServiceBean_v2_0" method="POST" /> </processor-chain> This is because cxf is intercepting, so after the processor chain you would have the same object as you had in your previous solution....

Profile/account REST API naming convention

php,web-services,api,rest,http

Your resource URIs should be more or less constant, and the HTTP verb determines what action is performed, eg: /api/orders: GET: list orders POST: create new order /api/orders/{order-id}; GET: retrieve info about an order POST: create an order with the specified ID PUT: modify an order DELETE: remove an order...

Headers for security

security,http,header

You definitely don't want to put them in HTML using <meta> tags, as JavaScript can just remove them, and (correct) browsers will ignore them. You need to set them as HTTP response headers on the server, and this depends on your server / framework. You also don't want to do...

Python Multiplayer noughts and crosses [closed]

python,http,client,server,multiplayer

You can start from the twisted chatserver example """The most basic chat protocol possible. run me with twistd -y chatserver.py, and then connect with multiple telnet clients to port 1025 """ from twisted.protocols import basic class MyChat(basic.LineReceiver): def connectionMade(self): print "Got new client!" self.factory.clients.append(self) def connectionLost(self, reason): print "Lost a...

Can I submit a form with google's recaptcha in it from my app?

http,request,authorization,captcha,recaptcha

Turns out we are not supposed to do that kind of tricks with reCAPTCHA. There is no support for that in API. It seems that it was part of Google's design to prevent that kind of usage. The only walkaround I could come up with is to implement a WebView...

Android Java Http Request Post

java,android,http,request

The first problem may be that you didn't add the INTERNET permission in your AndroidManifest.xml. To resolve this just add this line <uses-permission android:name="android.permission.INTERNET" /> in your manifest. The other problem is that you're trying to execute a post request on main thread. It causes NetworkOnMainThreadException. You should use AsyncTask...

Meteor HTTP request structuring

javascript,http,meteor

This is the equivalent. It's a bit prettier in javascript. Server side code: var result = HTTP.post("https://api.locu.com/v2/venue/search", { data: { "fields": ["name", "menu_items", "location", "categories", "description"], "menu_item_queries": [{ "price": { "$ge": 15 }, "name": "steak" }], "venue_queries": [{ "location": { "locality": "San Francisco" } }], "api_key": "YOUR_API_KEY" } }); console.log(result.data);...

ASP.net MVC HTTP Request error with payload

asp.net,json,asp.net-mvc,http

You need to move the data to the Request Body. In Fiddler it would be a separate input box (below the one in your screenshot). Your Headers for POST http://localhost:53660/api/pooltests become: User-Agent: Fiddler Host: localhost:53660 Content-Type: application/json Content-Length: 140 The headers Content-Type should be application/json and the Content-Length will be...

Django doesn't parse a custom http accept header

python,django,http,django-views,django-rest-framework

Try defining a custom renderer and setting the media_type attribute. from rest_framework.renderers import JSONRenderer class MyRenderer(JSONRenderer): media_type = 'application/vdn.name.v1+json' Then enable your renderer (see the docs for more info) REST_FRAMEWORK = { 'DEFAULT_RENDERER_CLASSES': ( 'path.to.MyRenderer', 'rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer', ) } ...

AngularJS simple auth interceptor

ajax,angularjs,http,angular-http-interceptors

If you want to add your token to each request, and respond to any errors, your best bet would be to use an Angular HTTP interceptor. Subject to your needs, it might look something like this: $httpProvider.interceptors.push(function ($q, $state, $localStorage) { return { // Add an interceptor for requests. 'request':...

What does `expires -1` mean in NGINX `location` directive?

caching,nginx,cache-control

If expires -1 is used, it means that these pages are never cached. The expire directive instructs the browser to expire file cache after a certain amount of time (or at a certain time). If a negative value is given, there is no caching.

Converting curl command to iOS

ios,swift,http,curl

Body is not used in GET http methods. Use the following code to concat your params: extension String { /// Percent escape value to be added to a URL query value as specified in RFC 3986 /// /// This percent-escapes all characters besize the alphanumeric character set and "-", ".",...

Python exception for HTTP response codes

python,http,exception

The built-in Python exceptions are probably not a good fit for what you are doing. You will want to subclass the base class Exception, and throw your own custom exceptions based on each scenario you want to communicate. A good example is how the Python Requests HTTP library defines its...

Integrating PHP Curl

php,mysql,xml,http,php-curl

You can send xml data using curl with following code $input_xml = ''; //XML Data $url=''; // URL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, "xmlRequest=" . $input_xml); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); $data = curl_exec($ch); curl_close($ch); ...

nodejs head request isn't triggering events

node.js,http

The problem is that you don't declare a data or readable event handler. According to the fine manual: A Readable stream will not start emitting data until you indicate that you are ready to receive it. Instead, the stream will be put in a "paused" state indefinitely (until you start...

$http headers is not a function - angularjs

php,angularjs,http

As Andy said already, headers is the 3rd parameter of the success callback. So you will have to do this:- success(function(data, status, headers, config) { // this callback will be called asynchronously // when the response is available }) I wasn't going to add this as an answer but doing...

How to retrieve HttpPost parameters in c#

c#,http,http-post,http-post-vars

According to microsoft here: http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api You have to add "[FromBody]" in the parameter list. You can only have one of these types of parameters. Also in the chrome post extension under headers you need to enter: Name: Content-Type Value: application/json...

Android http error

android,http

A NetworkOnMainThreadException means you are trying to access the network on the main thread, try creating a new Thread and accessing the network there. The exception that is thrown when an application attempts to perform a networking operation on its main thread. (http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html) ...

Server initiated requests

http,go,http2

Before websockets we had polling. This literally means having the client periodically (every few seconds, or whatever time period makes sense for your application), make a request to the server to find out the status of the job. An optimization many people use is "long" polling. This involves having the...

Can the HTTP method “PATCH” be safely used across proxies etc.?

http,caching,filter,proxy,http-patch

The answer to this question is a moving target. As time progresses and PATCH either becomes more or less popular, the systems in the network may or may not support it. Generally only the network entities that will care about HTTP verbs will be OSI Level 3 (IP) and up...

NSIS: Make async web request with query string

http,asynchronous,nsis,sendasynchronousrequest

You could try the InetBgDL plug-in but you are still stuck with having to deal with the output file. You can just dump those into $pluginsdir...

Why I got so many connection events on Node's HTTP server?

javascript,node.js,http,websocket,socket.io

The connections you're logging from the HTTP server are to be expected and are related to the resources that are being used on your HTML pages (JS, CSS, images, favicon, etc). The port numbers you're logging are the client side port numbers. While not random, they will change for every...

ActiveMQ http connection refused

java,http,activemq,connect

Find below a stripped down example to start the broker. Your Producer runs without any problem. activemq.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> <broker...

how make Sync or Async HTTP Post/Get in Android Studio

android,http,android-studio

The example I have posted below is based on an example that I found on the Android Developer Docs. You can find that example HERE, look at that for a more comprehensive example. You will be able to make any http requests with the following import android.app.Activity; import android.os.AsyncTask; import...

Does Ruby support nonblocking HTTP requests without a third-party library?

ruby,http,asynchronous,gem,eventmachine

Based on my tests, MRI does support nonblocking HTTP requests simply by using a thread. Threads don't always allow parallelism in Ruby due to the GIL, but net/http appears to be one of the exceptions: require 'net/http' require 'benchmark' uri = URI('http://stackoverflow.com/questions/30899019/') n = 10 Benchmark.bm do |b| b.report {...

Particular URL redirect to http if request come from particular host

apache,http,mod-rewrite,ssl,url-rewriting

You should add another RewriteCond to exclude redirect for this IP: RewriteCond %{SERVER_PORT} =80 RewriteCond %{REMOTE_ADDR} !=10.1.2.3 RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L] ...

HttpTransportSE .call() method has no action

java,android,http,ksoap2

!!!! WORKING CONFIRMED !!! main public class MainActivity extends Activity{ public static String rslt,thread; SoapMiddleMan c; EditText txtZIP; TextView weather; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtZIP = (EditText)findViewById(R.id.zipCode); weather = (TextView)findViewById(R.id.weather); } public void sendMessage(View view) { try{ // condition for keeping the main thread asleep thread =...

In simple RESTful design, does PATCH imply mapping to CRUD's (ORM's) “update” and PUT to “destroy”+“create” (to replace a resource)?

database,rest,http,orm,crud

Well, Both the actions actually means update, where PUT is full update and PATCH is partial update. In case of PUT you already know the identifier of the resource and the resource already exists, so it is not a create and delete action per se. Infact, you can make do...

Copied ssl cert to a test site, how do I remove it?

http,ssl,drupal,https,softlayer

https://www.drupal.org/https-information has some information on how to use SSL certs in drupal specifically. Since you didn't provide the actual error your browser is giving you, I'm going to guess its a domain name mismatch error (like this https://www.digicert.com/ssl-support/certificate-name-mismatch-error.htm ). Basically you will either need to access your site via the...

Python - sending http requests as strings

python,http,get

Assuming python 3, it is recommended that you use urllib.request. But since you specifically ask for providing the HTTP message as a string, I assume you want to do low level stuff, so you can also use http.client: import http.client connection = http.client.HTTPConnection('www.python.org') connection.request('GET', '/') response = connection.getresponse() print(response.status) print(response.msg)...

ActiveMQ http connection error

java,http,jms,activemq,producer

I guess you are mixing different ActiveMQ version/packaging and one of them is 5.9.0 (or before). The field sentCount exist since version 5.9.1. Version 5.9.0 was released on 14.Oct.2013 the field sentCount was added on 03.Dec.2013 ...

Simple Java Web validation Neither BindingResult nor plain target object for bean name 'number' available as request attribute

java,spring,http,web

In showHomePage method, change to @ModelAttribute("number") and: if(result.hasErrors()) { return "validation"; } return "success"; ...

what does php's header function do?

php,function,http,header,content-type

why this code is sending "header('HTTP/1.1 200 OK');"? i know this code means that the page is Good, but why are we sending this code??_ This tells your browser that the requested script was found. The broswer can then assume it will be getting some other data as well....

Docker container http requests limit

http,elasticsearch,docker

So, it wasn't a problem with either Docker or Elastic. Just to recap, the same script throwning PUT requests at a Elasticsearch setup locally worked, but when throwning at a container with Elasticsearch failed after a few thousand documents (20k). To note that the overal number of documents was roughtly...

request.headers['HTTP_AUTH_TOKEN'] does not work for https server

ruby-on-rails,http

It turns out that I need to use key HTTP_X_AUTH_TOKEN in order to get the value. And I also need to prepend X- to all my custom headers, otherwise the web server won't be able to recognize the custom headers.

How to return value in Meteor.JS from HTTP.call “GET”

javascript,ajax,http,meteor,facebook-javascript-sdk

Don't pass a callback to get the HTTP to return. You're also able to pass off URL parameters quite easily: var result = HTTP.call("GET", "https://graph.facebook.com/me", { params: { access_token : Meteor.user().services.facebook.accessToken, fields : "likes.limit(5){events{picture,cover,place,name,attending_count}}" } }); console.log(result); ...

Idempotent PUT in a concurrent environment

api,rest,http,idempotent

Idempotency means that in an isolated environment multiple requests from a same client does not have any effect on the state of resource. If request from another client changes the state of the resource, than it does not break the idempotency principle. Although, if you really want to ensure that...

How to create the get method for the call

php,arrays,json,http,quickblox

It should be something like this: https://api.quickblox.com/push_tokens.json?push_token[environment]=production&push_token[client_identification_sequence]=aa557232bc237245ba67686484efab&device[platform]=iOS&device[udid]=5f5930e927660e6e7d8ff0548b3c404a4d16c04f ...

Which LiftResponse class is appropriate for returning an XML based file format?

xml,http,lift

JsonResponse and PlainTextResponse are helpers that ultimately return an InMemoryResponse. You can see the source code here and here respectively. You will notice that PlainTextResponse sets a mimetype of "text/html" which is not necessarily correct for XML. There is also an XmlResponse type that you can investigate here and which...