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