Pak Jiddat - Innovative Software Services

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. Preventing browsers from caching content
  2. Making HTTP POST requests from Google Chrome
  3. Increasing web server timeout
  4. Redirect http to https with Apache
  5. Creating and Installing Apache Self Signed Certificate
  6. Using flags with rewrite rule
  7. Redirecting without mod_rewrite using regular expressions in htaccess
  8. Generate Certificate Signing Request (CSR) for ssl certificates
  9. Disabling output buffering with mod_fcgid
  10. Configuring Apache mod status
  11. Redirect http to https with Nginx
  12. Blocking visitors by http method using LimitExcept Apache directive
  13. Access control directives for Apache
  14. Passing query parameters to proxy server in Nginx
  15. Use of Preflight request in HTTP Cross Origin Resourse Sharing (CORS)
  16. Using RewriteCond directives
  17. Adding event listeners using JavaScript
  18. Using Prefetch, Preload and Preconnect for speeding page load times
  19. Get current unix timestamp using Javascript
  20. Fetching html elements using CSS selectors with Javascript
  21. Fetching html elements using CSS class names
  22. Fetching parent node element of a HTML node
  23. Adding option to html selectbox using Javascript
  24. Changing CSS styles using Javascript
  25. NodeJs permission denied error
  26. Customizing Redmine layout
  27. Passing parameters to Jquery event handler function
  28. W3C.Data
  29. Making cross domain Ajax calls using JSONP
  30. Using cookies in Javascript
  31. Javascript JSON guide
  32. Convert javascript object to json string
  33. Javascript date object
  34. Get the time using JavaScript
  35. Using keydown event handler for detecting enter key press
  36. Get co-ordinates of element relative to document using Jquery
  37. Using clearTimeout and onmouseenter, onemouseleave events
  38. Replacing a string using Javascript replace function
  39. Base64 Encoding of utf-8 encoded string using Javascript
  40. Setting CSS styles using JQuery
  41. Replacing html element using replaceWith jquery function
  42. Iterate throught Javascript object properties
  43. Select contents on text field