Pak Jiddat

Read: In the name of thy Lord Who createth, Createth man from a clot. Read: And thy Lord is the Most Bounteous, Who teacheth by the pen, Teacheth man that which he knew not. Nay, but verily man is rebellious That he thinketh himself independent!. Lo! unto thy Lord is the return. (Sura Alalaq 96:8)

Allowing Cross Origin Requests using htaccess

Created On: 29 Mar, 2017: 17:04:32 - Tags : javascript | web servers

Url: http://stackoverflow.com/questions/14467673/enable-cors-in-htaccess

htaccess directives can be used to allow requests from different domains. For example the following directives added to htaccess file should allow access from any domains:


Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

Related Articles

  1. Using await and async with Promises
  2. ES6 brings new features to JavaScript
  3. Using Web Components in JavaScript
  4. Using JavaScript promises
  5. JavaScript arrow functions and the let keyword
  6. Using classes and objects in JavaScript
  7. Using Generators in JavaScript
  8. Difference between ECMAScript, TypeScript and JavaScript
  9. Adding event listeners using JavaScript
  10. Using Prefetch, Preload and Preconnect for speeding page load times
  11. Get current unix timestamp using Javascript
  12. Fetching parent node element of a HTML node
  13. Adding option to html selectbox using Javascript
  14. Fetching html elements using CSS class names
  15. Fetching html elements using CSS selectors with Javascript
  16. Changing CSS styles using Javascript
  17. NodeJs permission denied error
  18. Customizing Redmine layout
  19. Passing parameters to Jquery event handler function
  20. W3C.Data
  21. Making cross domain Ajax calls using JSONP
  22. Use of Preflight request in HTTP Cross Origin Resourse Sharing (CORS)
  23. Javascript JSON guide
  24. Using cookies in Javascript
  25. Convert javascript object to json string
  26. Javascript date object
  27. Get the time using JavaScript
  28. Base64 Encoding of utf-8 encoded string using Javascript
  29. Setting CSS styles using JQuery
  30. Replacing html element using replaceWith jquery function
  31. Using keydown event handler for detecting enter key press
  32. Replacing a string using Javascript replace function
  33. Using clearTimeout and onmouseenter, onemouseleave events
  34. Get co-ordinates of element relative to document using Jquery
  35. Iterate throught Javascript object properties
  36. Select contents on text field
  37. PrivateTmp systemd option prevents access to tmp folder
  38. Generating free SSL certificate from LetsEncrypt on localhost
  39. INADEQUATE_SECURITY - SSL Cipher problems with HTTP2
  40. Preventing browsers from caching content
  41. Making HTTP POST requests from Google Chrome
  42. Increasing web server timeout
  43. Redirect http to https with Apache
  44. Creating and Installing Apache Self Signed Certificate
  45. Using flags with rewrite rule
  46. Redirecting without mod_rewrite using regular expressions in htaccess
  47. Generate Certificate Signing Request (CSR) for ssl certificates
  48. Disabling output buffering with mod_fcgid
  49. Configuring Apache mod status
  50. Redirect http to https with Nginx
  51. Blocking visitors by http method using LimitExcept Apache directive
  52. Access control directives for Apache
  53. Passing query parameters to proxy server in Nginx
  54. Using RewriteCond directives