Skip to main content
Solved

CORS Error

  • February 4, 2026
  • 8 replies
  • 54 views

Bruce Cheatwood
Forum|alt.badge.img+2

We are attempting to submit a JCL job to our local enterprise solution server via the ESMAC JES control API and are receiving a response with code 400 and message stating “No Origin of Referer header present.” How do we configure the server to allow access control from all origins?

Best answer by Bruce Cheatwood

I resolved the issue. Initially, I suspected it was a CORS problem, but it turns out the origin must be specified in the request header. The headers for Origin, X-Requested-With, and Accept are now included in the API request, ensuring proper recognition and feedback. While the API gateway now accepts the request, I am encountering a 500 status code error due to a failure to bind to MLDAP.

 

Uri uri = new Uri(url);

HttpClient httpClient = new HttpClient();

client.DefaultRequestHeaders.Host = uri.Host;

client.DefaultRequestHeaders.Add(“Origin”, $”{uri.Scheme}://{uri.Host}”);

client.DefaultRequestHeaders.Add(“X-Requested-With”, ”XMLHttpRequest”);

client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(@”application/json”));

 

 

8 replies

Kim Hoskin
Forum|alt.badge.img+2
  • Moderator
  • February 5, 2026

Hi Bruce,

Please share a screenshot or the details of the command and it’s output, this will help us to understand what your command looks like, see if anything can/should change there.

Regards,
Kim


Bruce Cheatwood
Forum|alt.badge.img+2

string url = "http://lvdap38:10086/native/v1/regions/10.10.2.187/49100/QCRS/jescontrol";
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Access-Control-Allow-Origin", "*");
client.DefaultRequestHeaders.Add("Referer", @"http://lvdap38:10086/native/v1/regions/10.10.2.187/49100/QCRS/jescontrol");
var requestData = new JobSubmission()
{
    ctlSubmit = "Submit",
    subJes = 1,
    JCLIn = "JCL string",
    JCLInBase64 = false,
    dctFName = "G,X",
    batType = 1,
    dctFSN = "",
    dctPath = "",
    xatSwitch = "",
    statusCodes = true
}
string json = Newtonsoft.Json.JsonConvert.SerializeObject(requestData);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
string responseContent = await response.Content.ReadAsStringAsync();
if (response.StatusCode == HttpStatusCode.OK)
{
    //code to continue processing
}
else if (response.StatusCode == HttpStatusCode.BadRequest)
{
    //code to handle bad request
}
else
{
    //code to handle other status codes
}

JobSubmission is a class with properties corresponding with JSON requirements of the API we’re trying to use.

 

Error when NOT including Referer header: Code 400, Message “No Origin or Referer header present”

Error when including Referer header: Code 400, Message “No X-Requested-With header present”


Kim Hoskin
Forum|alt.badge.img+2
  • Moderator
  • February 6, 2026

Are you using this via a VB / Powershell type script?
Can you consider this approach:
Test this via the ESCWA Docs API page first, URL: 
http://localhost:10086/docs/
>
http://localhost:10086/docs/#/JES/get_v2_native_regions__host___port___region__jescontrol
Once you have that working in there then take the working command to your script.

Regards,
Kim


Bruce Cheatwood
Forum|alt.badge.img+2

Hi Kim,

I wanted to provide some additional context regarding the issue with the API call to the QCRS/jescontrol endpoint. We're confident that the endpoint is correct because we are receiving a 400 status code, which indicates a bad request, rather than a 404 status code that would suggest the endpoint itself is not found.

The error message we are receiving points to a potential issue with a missing header in the HTTP request or a CORS configuration problem on the Rocket Enterprise Server. Specifically, it seems to indicate that the server is expecting certain headers to be present in the request, and without them, it cannot process our request properly.

In response to your inquiry about our scripting language, we are not using VB or PowerShell. Instead, we are utilizing C# with the HttpClient class to send the request to the API. This allows us to construct the request and handle the response programmatically.

If you have any insights on the specific headers that may need to be included in the request or if there are adjustments required for the CORS settings on the server, that would be incredibly helpful.

Thank you for your assistance!


Kim Hoskin
Forum|alt.badge.img+2
  • Moderator
  • February 9, 2026

Hi Bruce,

I believe this knowledge base article can help:
Title: How to use ESCWA API using curl
URL: https://my.rocketsoftware.com/RocketCommunity/s/article/How-to-use-ESCWA-API-using-curlPlease 
I recommend you to review that, compare what might be different or missing with your C# test and let us know of the result.

Regards,
Kim


Bruce Cheatwood
Forum|alt.badge.img+2
  • Author
  • Inspiring
  • Answer
  • February 9, 2026

I resolved the issue. Initially, I suspected it was a CORS problem, but it turns out the origin must be specified in the request header. The headers for Origin, X-Requested-With, and Accept are now included in the API request, ensuring proper recognition and feedback. While the API gateway now accepts the request, I am encountering a 500 status code error due to a failure to bind to MLDAP.

 

Uri uri = new Uri(url);

HttpClient httpClient = new HttpClient();

client.DefaultRequestHeaders.Host = uri.Host;

client.DefaultRequestHeaders.Add(“Origin”, $”{uri.Scheme}://{uri.Host}”);

client.DefaultRequestHeaders.Add(“X-Requested-With”, ”XMLHttpRequest”);

client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(@”application/json”));

 

 


Kim Hoskin
Forum|alt.badge.img+2
  • Moderator
  • February 9, 2026

That is great news, thanks for the feedback Bruce.


Bruce Cheatwood
Forum|alt.badge.img+2

The MDLAP issue we were having was resolved by fixing our incorrect host and port in the endpoint. We were trying to use the host and port of the listener inside the region or server which was not working.

It seems the host and port in the endpoint must be the host and port of the region or server.