I make a placeholder service, I add a "cache-control" header by nginx:
But when I visit this url ( https://z.wiki/placeholder/300x400 ) by chrome, there is not cache, why ? thx~
Related
I'm currently stuck on a proxy problem : I use lighttpd to serve html pages on port 443, and now I want to access another local website (only accessible with localhost) and with https, while he can't handle it.
My solution's to use lighttpd as proxy to redirect all requests of the interface 192.168.x.x: in the local interface (127.0.0.1:).
As example, if my local server's on port 8080, all the 192.168.x.x:8080 are redirect on 127.0.0.1:8080, but the url in my browser still 192.168.x.x:8080. With this configuration, i can let lighttpd setup https.
But now I'm stuck on the redirection, i use mod_proxy but nothing work and the page can't be found :
$SERVER["socket"] == "192.168.x.x:8080" {
ssl.engine = "enable"
ssl.pemfile = "/etc/ssl/server.pem"
proxy.server = ( "" => (
"api:8080" => # name
( "host" => "127.0.0.1", # Set the IP address of servername
"port" => 8080
)
)
)
}
what did a do wrong ?
Thanks in advance !
PS : I use the version 1.4.53 of lighttpd
EDIT
To be more precise, I just want a basic proxy usage from ligttpd :
I add ssl engine and ssl pemfile for my 8080 port listener
I added in varnish file "default.vcl" a code for check if Varnish cache is working but I get a Transfer-Encoding "Chunked" and I cant see if Cache is working displaying HIT or MISS. I follow next tutorial and I believe have some port in nginx blocking his right function.
Code added within of "sub vcl_deliver":
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
My settings:
Apache 2.4.6 port by default 7080
etc/nginx/nginx.conf without port by default (without port added)
etc/nginx/plesk.conf.d/server.conf > server listen port MyIP:80 (default)
Varnish port 80 to external 32780 (Added from plesk)
etc/varnish/default.vcl: In host my IP and in port 7080
How can delete "Transfer-Encoding Chunked" and remplace it for "X-Cache MISS or HIT" to show in headers ?
Best regards
I want to use an iframe in my localhost web server (wamp).
This iframe loads a form from a remote web server.
I have access to the remote web server, it uses apache2 (https://help.ubuntu.com/lts/serverguide/httpd.html), and i modify its security.conf file and i load the module 'headers'.
I modify security.conf by this line (the ip is the ip of my local computer):
Header append X-Frame-Options "ALLOW-FROM http://localhost, http://172.18.48.120, 172.18.48.120"
But when i test the changes, always says the same:
Refused to display 'http://externalURL.net/form.php' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Any idea? Where's the problem?
Just for completeness:
Here are the lines to add to your apache2/conf-available/security.conf file to make your iframed content available in browsers supporting either or both X-Frame-Options and Content-Security-Policy header options (as stated on this survey site)
Header set X-Frame-Options: "ALLOW_FROM https://www.example.com"
Header set Content-Security-Policy: "frame-ancestors
https://www.example.com"
Make sure that header module is enabled
a2enmod headers
restart apache
service apache2 restart
That's it !
Finally i solved it, the solution is:
Load module headers in apache2.
Modify file security.conf, you have to append this line:
Header set X-Frame-Options 'ALLOW-FROM http://externalURL.net'
(it's a valid option if you use a local web server, e.g. wamp:
Header set X-Frame-Options 'ALLOW-FROM http://localhost')
Reload service apache2.
If you want to test it, don't use Google Chrome, it ignores x-frame-options directive and it always says the same message:
Refused to display 'http://externalURL.net/form.php' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
It's ok with Firefox.
After installing varnish in front of apache2, I can not access the dev environment of symfony2 project (connected from localhost, so it worked before installing varnish).
I got the symfony2 access denied message "You are not allowed to access this file. Check app_dev.php for more information."
When looking into app_dev.php file:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(#$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
After debuging the problem, i found that the $_SERVER['HTTP_CLIENT_IP'] is NULL.
How to fix this ?
Thank you.
Note: I'm using ubuntu 14.04 + apache2.4 + varnish 3 + Symfony2.4
The line would return a 403 if either:
HTTP_CLIENT_IP header is present
HTTP_X_FORWARDED_FOR header is present
$_SERVER['REMOTE_ADDR'] is not one of '127.0.0.1', 'fe80::1', '::1'
Probably you are setting the HTTP_X_FORWARDED_FOR header in varnish, or varnish is setting it for you, depending on the varnish version. Unset it or rewrite the condition, it's a safety measure so act accordingly.
You have some interesting info here: http://symfony.com/doc/current/cookbook/cache/varnish.html
I need to define a cookie on with nginx according to this doc : http://wiki.nginx.org/HttpUseridModule
But when I set :
userid on;
userid_name SessionStatId;
userid_domain orange.fr;
userid_path /;
userid_expires 8y;
Expire is set to session and not ten years as defined!
Do you know why and how can I work around this?
I found it !
In my Firefox configuration, I've ajust it to clean all cookies by firefox closure.
So all cookies were setted to expire at the end of session. It was that !