I am trying to create a cron job to access a particular URL to do some maintenance stuff. While accessing the URL remotely from Chrome works fine (returns 200 OK), accessing it locally on the server with wget gets me "ERROR 503: Service Unavailable."
root#domain:/home/admin/web/domain.com/public_html/# wget http://www.domain.com/index.php?route=module/marketplace&action=run_queue
[1] 30283
root#domain:/home/admin/web/domain.com/public_html/# --2016-09-06 16:02:42-- http://www.domain.com/index.php?route=module/marketplace
Resolving www.domain.com (www.domain.com)... 46.10.20.30
Connecting to www.domain.com (www.domain.com)|46.10.20.30|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2016-09-06 16:02:42 ERROR 503: Service Unavailable.
I am using Apache/2.4.7 (Ubuntu) + Nginx for serving static files.
Headers sent by Chrome
GET /index.php?route=module/marketplace&action=run_queue HTTP/1.1
Host: www.domain.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
DNT: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,ro;q=0.6
Cookie: cookieconsent_dismissed=yes; __tawkuuid=e::domain.com::qsV03tUWg5avl3mTmLetAJpcbS+TGvpb7L33ER0ooHvJ0wsAPilIfGadi5f::2; Tawk_55ec3df37d21121ad0a5a=vs16.tawk.to:443::0; currency=USD; __atuvc=10%7C34; PHPSESSID=foru997tgbo437je6djtd3c2; language=ro; _ga=GA1.2.13206174.14484999; TawkConnectionTime=0; language=ro; currency=RON
Headers received in Chrome
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 06 Sep 2016 13:22:23 GMT
Content-Type: text/html
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=10
X-Powered-By: PHP/5.5.9-1ubuntu4.19
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
What might be the problem here?
It was the comment of Margaret Bloom below my question which solved my problem. It was in fact an authentication problem and once I had the website correctly configured to be publicly accessible, wget started working normally.
It was initially working in Chrome because I was authenticated there.
Thanks.
Related
I'm working with a very simple application using Grails 3.0.2, secured with Spring Security Core Plugin version 3.0.0.M1. I have only one Book domain with fields title, author and content and run the generate-all script for that domain. The problem is that when I try go to /book/index, after successfully logged in, I get an http "406 Not Acceptable" error.
This is my http request header:
GET /book/index HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/login/auth
Cookie: _ga=GA1.1.1278470533.1431342674; JSESSIONID=7DE58D010998C57939E6258A7148F0C6
Connection: keep-alive
Cache-Control: max-age=0
and response:
HTTP/1.1 406 Not Acceptable
Server: Apache-Coyote/1.1
X-Application-Context: application:development
Content-Type: text/html;charset=ISO-8859-1
Content-Language: it-IT
Content-Length: 312
Date: Fri, 04 Sep 2015 07:39:37 GMT
I've resolved problem adding:
static responseFormats = ['html', 'xml', 'json']
in my controller.
Can you help me with an explanation of what happened and/or give better solutions?
Thanks in advance for your help.
my question seems duplicate of this
but I am having a case
when I refresh a page with F5 then images are not getting fetched from cache instead request is going to server and server responding 304 status code(not modified)
but if I type a URL in address-bar or navigate page from browser back/forward button then images are coming from cache.
but I am having one doubt here why request is made for cached images to origin server on F5 (page refresh)
Nginx configuration
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 2d;
proxy_pass http://localhost:3001;
break;
}
Request header
===================================
GET /assets/first_banner.png HTTP/1.1
Host: localhost:3000
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
Accept: image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
Referer: http://localhost:3000/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
===================================
Response header:
===================================
HTTP/1.1 200 OK
Server: nginx/1.1.19
Date: Sun, 08 Dec 2013 20:31:06 GMT
Content-Type: image/png
Content-Length: 141498
Connection: keep-alive
Cache-Control: max-age=172800
Last-Modified: Wed, 23 Oct 2013 05:34:11 GMT
Etag: "0fc96d0218a47398d37dacca76916727"
X-Ua-Compatible: IE=Edge
X-Request-Id: 48d1ec3a24e2c0f13250ea74101f6753
X-Runtime: 0.021479
Expires: Tue, 10 Dec 2013 20:31:06 GMT
===================================
When you hit F5 you tell the browser to check the webserver if the content, cached locally or not, is still valid.
If the object is expired on the webserver then the browser fetch the asset again. If the object is still valid, the local browser-cached content is used.
During development of an IIS module for basic authentication, I stocked to a problem. The module is working fine when browsing the pages, but when calling web-services it seems that request does not reach the module and some in-the-middle module takes control of request.
using fiddler, I found out when Content-type in http request header is set to application/json that in the middle module/handler is triggered. so following request does not work:
when working fine, the server should ask client to send the user credentials by setting the WWW-Authenticate header in response
GET /WebServices/service.asmx/someMethod?param=test HTTP/1.1
Host: localhost
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Content-Type: application/json
asdfasdf
asdfasdfasdf
response: notice the jsonerror header in response
HTTP/1.1 401 Unauthorized
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
jsonerror: true
X-Powered-By: ASP.NET
Date: Mon, 11 Mar 2013 23:49:02 GMT
Content-Length: 105
{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.In
validOperationException"}
where this one works fine: notice that there is no content-type
GET /WebServices/service.asmx/someMethod?param=test HTTP/1.1
Host: localhost
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
asdfasdf
asdfasdfasdf
and the correct response is: notice the WWW-Authenticate header in response
HTTP/1.1 401 Unauthorized
Location: http://localhost/WebServices/service.asmx/someMethod?param=test
Server: Microsoft-IIS/7.5
WWW-Authenticate: Basic
X-Powered-By: ASP.NET
Date: Mon, 11 Mar 2013 23:59:48 GMT
Content-Length: 0
Well, that in-the-middle module was ScriptModule where we had both 3.5 and 4.0 version being added in the config. inspecting them through dotpeek, I found that the script module checks request's content-type against being application/json and then tries to handle the request as a REST request or webservice call.
By removing them, nothing special happened. I assume that they are to be used when script manager or Microsoft Specific AJAX services are used. You can find more about it in
ASP.Net Ajax Programming Tricks
I've read all the caching documentation for HTTP, and this are the headers for my file:
Edit: I am now using amazon S3 to see if it helps and still the same problem! Here go the request and the response> What am I missing? Even thought the response asks for the browser to cache the file, it doesn't! I've checked the Google Chrome cache and the file is not there.
Request URL:https://s3-sa-east-1.amazonaws.com/combo-combat-release/WebPlayer.unity3d
Request Method:GET
Status Code:200 OK
**Request Headers**
GET /combo-combat-release/WebPlayer.unity3d HTTP/1.1
Host: s3-sa-east-1.amazonaws.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
**Response Headers**
HTTP/1.1 200 OK
x-amz-id-2: xu/RKgR4Xt6G3jQ1qkdO5rzd4TlngDYYERZ+bbGlalitJFMDjAgiLAoP4GXhmkeo
x-amz-request-id: 6A9389D16407D28D
Date: Wed, 16 Jan 2013 22:42:26 GMT
Cache-Control: max-age=2592000, public, must-revalidate
Last-Modified: Wed, 16 Jan 2013 22:29:55 GMT
ETag: "0f8d22257da9fcae61f21fd30b7a1fd4"
Accept-Ranges: bytes
Content-Type: application/octet-stream
Content-Length: 39222189
Server: AmazonS3
But the browser doesn't cache the file. Each time, the request is sent and all the data transferred from scratch (200 OK instead of 304). :(
File size is 37.4 MB
Any tip on what could be wrong?
Thanks,
Manuel
Try HTTP 1.1 instead of 1.0.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html states:
Note that HTTP/1.0 caches might not implement Cache-Control and
might only implement Pragma: no-cache
When pages on our website are updated and we load them in the browser they are never reloaded (until I explicitly refresh).
The first time I load Chrome Developer Tools just says "(from cache)" and doesn't show any headers but I reckon they should always send a request to validate the ETag. Or maybe the server sends a 304 Not Modified response status in error but this doesn't show up in the Network tab.
When I refresh, these are the headers. Anyone sees what is wrong?
Request
GET /home/index.html HTTP/1.1
Host: *******.be
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://*****.be/home/index.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
If-None-Match: "c38f300d-114d-4c2565b57b420"
If-Modified-Since: Wed, 13 Jun 2012 08:27:42 GMT
Response
HTTP/1.1 304 Not Modified
Date: Wed, 13 Jun 2012 11:24:52 GMT
Server: Apache
Connection: close
ETag: "c38f300d-114d-4c2565b57b420"
I have tested this with Chrome 19 and IE9.