Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:21:26+00:00 2026-06-18T12:21:26+00:00

After running into the famous Access-Control-Allow-Origin problem while testing ServiceStack, I did a bunch

  • 0

After running into the famous Access-Control-Allow-Origin problem while testing ServiceStack, I did a bunch of reading on CORS to better understand the problem. I also came across this very helpful SO question.

However, the solutions there did not work for me. I tried including the CorsFeature plugin and also setting the endpoint config manually, but after trying both ways I saw that the response headers coming back from the server did not include any of my Access-Control-Allow-* headers, hence the problem remained.

I tried another solution which ended up working for me (through with some other problems that aren’t relevant here). I added the following to my service’s web.config:

<system.webServer>
  [...snip...]
  <httpProtocol>
    <customHeaders>
      <clear />
      <add name="Access-Control-Allow-Origin" value="*" />
      <add name="Access-Control-Allow-Headers" value="Content-Type" />
      <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
    </customHeaders>
  </httpProtocol>
</system.webServer>

(Other readers, note that this only works on IIS7+. See http://enable-cors.org/ to learn more about enabling CORS on other servers)

My question is: why was I able to get my headers written using this web.config method, but not by using ServiceStack’s built-in CORS support? Is there a config setting I’m missing somewhere?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:21:28+00:00Added an answer on June 18, 2026 at 12:21 pm

    I was reviewing more of @mythz‘s SO answers and came across this one. For reasons I don’t fully understand (yet), adding in that request filter (as well as the CorsFeature plugin) allowed everything to work as expected. I don’t get an error on my preflight OPTIONS request, or any origin errors on my GETs and POSTs.

    So, in short, my final solution was to copy the code from mythz’s answer in that post into my AppHost.Configure(), and remove my web.config custom headers. (Before I removed my custom headers from my web.config, I was actually getting my headers doubled up!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While doing a school project I've been running into the following problem: After feeding
After running a bunch of simulations I'm going to be outputting the results into
I'm running into a problem immediately after doing Start-CacheCluster, my cache service has already
I am running into this problem where my page loads and then after a
I'm running into a problem using Bluetooth in my app. It seems that after
I'm running into a problem, where I keep getting this error after entering my
I'm running into this problem after installing node 0.6.6 https://github.com/isaacs/npm/issues/1842 I'm not sure how
I've been running into problem after problem trying to use the a third party
After running into the Yii asset engine I've read the official documentation (http://www.yiiframework.com/wiki/148/understanding-assets/). I
After changing the import as a from-import i'm running into this error: from datetime

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.