add_header Access-Control-Allow-Origin "*" To enable CORS, you have to add the following line to the configuration file (e.g. This is how you can enable CORS on Nginx Server #ĬORS can also be activated and changed with Nginx – the syntax is different compared to Apache. Now all you have to do is save the changes and restart your Apache service. ![]() Header set Access-Control-Allow-Credentials true Header set Access-Control-Allow-Origin "%e env=AccessControlAllowOrigin Have a look at the following lines to see how to add multiple domains in the nf file using conditions: SetEnvIf Origin "http(s)?://(AccessControlAllowOrigin=$0$1 ![]() On the other hand, if you want to allow CORS for several domains, it becomes a bit more tricky, you have to add conditions to allow multiple domains. Header set Access-Control-Allow-Origin "" Alternatively, you can only exclude individual domains from the restriction of the CORS header by adding the following line: Header set Access-Control-Allow-Origin "" This removes all restrictions, which means that other domains can also access data. Header set Access-Control-Allow-Origin "*" To activate CORS directly via nf, you have to add the following: Header set Access-Control-Allow-Origin "*"Īlternatively, insert the following line in. The HTACCESS variant only works if you have also activated mod_headers for Apache. To activate CORS for Apache, you either have to change the nf or expand your HTACCESS file. This is how you can enable CORS on Apache Server # Using the CORS header, you can then allow resources to be loaded from other domains so that they do not have to be stored twice (e.g. This can be useful for your WordPress website, for example, if you use WPML. However, in some cases it makes to enable CORS in Apache and Nginx for several Domains. SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X !.* CORS header is used to restrict cross-origin HTTP requests via scripts. Header set Cache-Control "max-age=600, private, must-revalidate" Header set Cache-Control "max-age=1209600, private" Header set Cache-Control "max-age=31536000, private" Header set Cache-Control "max-age=1209600, public" Header set Cache-Control "max-age=2592000, public" # Use UTF-8 encoding for anything served text/plain or text/htmlĮxpiresByType application/pdf "access 1 month"ĮxpiresByType text/x-javascript "access 1 month"ĮxpiresByType image/x-icon "access 1 year" #Header always edit Set-Cookie (.*) "$1 HttpOnly Secure samesite=lax" I have had this stuff in there for at least a year now.Īt the very top, the recent changes/suggestions. htaccess - The first line is already in there, has been since day one. So far I’ve only noticed this only on ONE of the sites, but that’s also the one I edit and post on the most currently, so perhaps all of them have it but I don’t do enough to it to cause the issue.Īnyone else has this problem? What do I do about it? Where is the issue? CP? Server? Browser? I have several sites on CP and most work fine. I’ve tried and seen the issue in Safari 15.x and Firefox 102 (macOS). Sometimes this happens after a few times saving (say 3-5) other times after 15+ times.Īkin to a stupid firewall blocking repeated requests. Header always edit Set-Cookie (.*) “$1 HttpOnly Secure samesite=lax”Īs described, save a page/post/product (in CC) and eventually it starts stalling and giving that error. ![]() No idea - According to my hosting provider something with cookies. XMLHTTPRequest cannot load URL_HERE due to access control checks If you look in console it gives a non descript error: It starts loading/saving, stalls and eventually times out on a white screen. When I click ‘Save as Draft’ or ‘Publish’ that the posts savespublishes Current behavior I don’t really understand the problem yet and my hosting provider is a twat in explaining anything blaming everything but themselves - Not very helpful in even understanding what’s going wrong… Expected behavior But it seems to have something to do with Cookie (or their policies) or CORS. I’m not sure what’s going wrong, or what causes it. Since a few weeks I’ve been noticing an issue when saving new or editing posts and stuff in CP.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |