How to disable Vary header in bitnami wordpress - wordpress

Which version of the application are you using?:
WordPress 4.8.2
Please choose how you got the application: Installer (Windows, Linux, macOS), cloud image (AWS, GCE, Azure, ...) or VM (VMDK, VBOX):
google cloud
Have you installed any plugin or modified any configuration file?:
wp super cache
Describe here your question/suggestion/issue (expected and actual results):
CDN can not hit my resource on edge server because of the vary header setting.
how to disable the vary:cookie?

You can unset the header in the /installdir/wordpress/conf/httpd-app.conf
file by adding the following:
<IfModule mod_headers.c>
Header unset Vary
</IfModule>
Hope it helps,
Michiel D'Hont

You could add it in the following way:
<IfModule mod_headers.c>
Header unset Vary
Header append Vary: Accept-Encoding
</IfModule>

Related

Allow Wordpress installed with Docker on Azure to be embeded as iframe

I created a simple webapp container with the image wordpress:latest on linux on azure.
Everything works fine. Now I tried to embed this website in a website which I am working on running on my localhost:port.
Since I don't have access to SSH to edit the wp-config.php or .htaccess (it's anyways in the docker container) I installed the plugin wp-htaccess-editor to have access to the .htaccess (it really has access... I did changes and checked with another plugin..)
# BEGIN HttpHeaders
# The directives (lines) between "BEGIN HttpHeaders" and "END HttpHeaders" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_headers.c>
<IfModule mod_setenvif.c>
SetEnvIf Origin "^(.+)$" CORS=$0
</IfModule>
Header set Access-Control-Allow-Origin %{CORS}e env=CORS
<FilesMatch "\.(php|html)$">
Header set X-Frame-Options "ALLOW-FROM http://192.....:5174"
</FilesMatch>
</IfModule>
# END HttpHeaders
But I still get the error:
Refused to display 'http://goofyPage.azurewebsites.net' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
But it is not true that x-frame-options is set to sameorigin.. it is set allow-from myLocalIP. => Somehow can it be that nginx overrides this option? since when I check the header data it is really still "sameorigin"...
What are my options to make this work? Should I add the header option also on Azure on my webApp->configuration->Application settings??
When I check https://goofyPage.scm.azurewebsites.net/Env#httpHeaders
AppSettings
Header = set X-Frame-Options ALLOW-FROM http://192...:5174
...
Environment variables
APPSETTING_Header = set X-Frame-Options ALLOW-FROM http://192....:5174
Header = set X-Frame-Options ALLOW-FROM http://192.....:5174

Need to change a file content type to text/plain so browsers don't prompt for a download and instead show it on the screen

I have a WordPress website hosted on a LiteSpeed server via the Hostinger platform.
I have a file called stellar.toml at www.example.net/.well-known/stellar.toml. The WordPress file manager plugin tells me the file's kind is Plain text.
But if I type its URL I get a download started, I need instead to have the file's text prompted on the screen.
Does anyone know how I can fix this issue?
Thanks in advance!
Create a .htaccess on your .well-known folder:
<IfModule mod_rewrite.c>
<FilesMatch "^stellar\.toml$">
AddType text/plain .toml
</FilesMatch>
</IfModule>

Where to create htaccess file for a wordpress site hosted in AWS

Been working on speed optimization for a WordPress site hosted in AWS.
Created .htaccess in the root folder of the site added this
<IfModule mod_expires.c>
<FilesMatch "\.(css|js|png|jpg|jpeg)$">
Header set Cache-Control "max-age=788400, proxy-revalidate"
</FilesMatch>
</IfModule>
Tested the site using GTMetrix, but it still throws 'Leverage Browser Caching'. Seems the htaccess is not taking effect. Is this the right place to put the .htaccess file?

Make mp4s download using Wordpress Multisite htaccess, only on specific subdomain

I am trying to get mp4's to download immediately when they are opened. And I've succeeded at that. However, I'm also trying to make this happen, only when the link is accessed from a specific subdomain. I run a Wordpress Multisite
I've run the following code in the Ifmodule to no avail. All the videos download immediately, no matter where they are accessed from. I'm pretty sure I'm using the conditioning wrong, but I can't find a good example of how to do this.
RewriteCond %{HTTP_HOST} ^www\.subdomain.example\.com$
<FilesMatch "\.(mp4|MP4)">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
Thanks for reading! (Double thanks for any help.)
Put the FileMatch directive in the vhost configuration for your domain. So, if the file sub.conf contains information about www.subdomain.example.com, you just have to add the following there:
<FilesMatch "\.[mM][pP]4">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>

Wordpress cross domain issues

I'm having issues with ..Cross-Origin Resource Sharing policy: The 'Access-Control-Allow-Origin' header..
The site runs on 3 different domains using the WPML plugin for 3 different languages. The references to e.g. the stylesheet URL point to 1 URL (the main domain) which means that 2 of the sites are requesting info cross domain and this is causing fonts not to load.
I'm hoping to solve this by removing the protocal and domain from the stylesheet URL's, so that it's pointing to a 'relative' path to the files (e.g. /wp-content/themes/salient/style.css?ver=4.8.1)
Is there a way to change this in Wordpress? Doesn't just have to be for the stylesheet, it can be for all the files that are referenced by Wordpress.
You can allow resources to be loaded from sub domain by adding following line to your .htaccess file
Load resources from sub-domain:
# Allow font, js and css to be loaded from subdomain
SetEnvIf Origin "http(s)?://(.+\.)?(example\.com)$" ORIGIN_DOMAIN=$0
<IfModule mod_headers.c>
<FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff|js|png|jpg|jpeg|gif)$">
Header set Access-Control-Allow-Origin %{ORIGIN_DOMAIN}e env=ORIGIN_DOMAIN
</FilesMatch>
</IfModule>
Load resources from all other domains:
# Allow font, js, and css to be loaded from subdomain
<IfModule mod_headers.c>
<FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff|js|png|jpg|jpeg|gif)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
Source: http://www.webspeaks.in/2015/01/wordpress-allow-cross-domain-resources.html

Resources