# Allow CORS in Pinegrow Browser

**URL:** https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73
**Category:** Feature Request
**Created:** [July 27, 2016, 7:34pm UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73 "2016-07-27T19:34:51Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![dejayo](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dejayo](https://forum.pinegrow.com/u/dejayo)
#### Post date: [July 27, 2016, 7:34pm UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/1 "2016-07-27T19:34:51Z")

</div>

Allow CORS in Pinegrow Browser,product is great thanks

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [July 28, 2016, 9:17am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/2 "2016-07-28T09:17:15Z")

</div>

Please give me a use-case of how it would be used.

---

<div class="post-metadata">

### Author: ![dejayo](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dejayo](https://forum.pinegrow.com/u/dejayo)
#### Post date: [July 28, 2016, 2:01pm UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/3 "2016-07-28T14:01:24Z")

</div>

Maybe it is not viable,I am only a beginner so I barely even know what I am talking about however I make simple apps using nw.js,usually just one page apps that get some Data from the net and manipulate the page with it,nw.js allow CORS,also making Windows 10 HTML apps allow CORS too,if pinegrow allowed that too I could write the app/HTML for the most part in Pinegrow

---

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [May 9, 2025, 4:36am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/4 "2025-05-09T04:36:01Z")

</div>

Adding to an old thread here, but I’ve encountered a use case.

Currently I’m designing a page which submits a form. However, testing this with the browser preview feature in PG results in a CORS error. This is because the website is served from PG (127.0.0.1:40000), and this is different from the backend server I’m submitting to (127.0.0.1:8080).

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [May 9, 2025, 6:42am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/5 "2025-05-09T06:42:33Z")

</div>

Are you experiencing the CORS error when you open your page in the external browser outside Pinegrow?

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [May 9, 2025, 6:44am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/6 "2025-05-09T06:44:05Z")

</div>

I believe you will have to set `Access-Control-Allow-Origin` header in the response from your backend server during development.

---

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [May 9, 2025, 7:04am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/7 "2025-05-09T07:04:04Z")

</div>

I don’t have a strong knowledge of CORS, so bear with me.

My understanding is that it is the source (origin) server which sets the permitted connections, as any alternative doesn’t make sense. So in this example, that’s Pinegrow. At least while designing the page.

So your suggestion is to move the page to a testing server and try it there? Which will work. But it is a lot of effort to do while working on the page and making adjustments.

Hence, my comment about a use case for setting the header within PG.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [May 9, 2025, 7:08am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/8 "2025-05-09T07:08:57Z")

</div>

> [@reflex](#):
>
> 127.0.0.1:8080

What’s your backend server running at port 8080?

---

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [May 9, 2025, 7:20am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/9 "2025-05-09T07:20:49Z")

</div>

That processes the form submission. At the moment it’s only a stub. Although it could be a commercial service in reality.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [May 9, 2025, 7:28am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/10 "2025-05-09T07:28:13Z")

</div>

Ohh okay, is that a node based express backend? Python or something like Django? Does your backend allows you to set cors settings?

By preview feature, are you referring to the internal browser, or you have opened your page in the external browser? Are you able to share a screenshot of the error, that would help with troubleshooting. Thanks!

---

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [May 9, 2025, 7:48am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/11 "2025-05-09T07:48:27Z")

</div>

Currently, the backend is a custom server I’m writing in Swift (using [Hummingbird](https://hummingbird.codes)). As such, I do have full flexibility to adjust settings.

To answer your other question, the situation I’m referring to is clicking on the “preview in browser” button in PG. My page opens in the browser (Safari) and I get the CORS error.

The console error I get is…

```auto
[Error] Origin http://127.0.0.1:40000 is not allowed by Access-Control-Allow-Origin. Status code: 200
[Error] Fetch API cannot load http://127.0.0.1:8080/update due to access control checks.
[Error] Failed to load resource: Origin http://127.0.0.1:40000 is not allowed by Access-Control-Allow-Origin. Status code: 200 (update, line 0)

```

I’ve observed that PG executes this feature by substituting any links in the page being previewed with links to its own internal server. Hence, my impression that the CORS setting must be done in PG itself.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [May 9, 2025, 7:58am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/12 "2025-05-09T07:58:37Z")

</div>

I did a quick search and it might be that you will have to whitelist your web server url ([https://127.0.0.1:40000](https://127.0.0.1:40000) in case of pinegrow) in your backend - [Hummingbird and CORS - Swift on server](https://swiftonserver.com/hummingbird-and-cors/)?

---

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [May 9, 2025, 8:27am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/13 "2025-05-09T08:27:31Z")

</div>

Thank you for your efforts. It’s really more than I was expecting.

I hope you don’t feel that I’ve wasted your time. I can get things working simply by turning off CORS restrictions in Safari’s developer settings. However not everyone will be able to do that. Which is why my original reply to @matjaz was in the context of providing a use case as he had asked for.

However, thanks to your efforts, I think I understand CORS better now. I’ve been on the wrong track. I’d imagined it was a security measure implemented at the source, to stop nefarious actors from altering a webpage to send / get its data to / from a malevolent site.

Now I see it’s a security measure on the target server which informs the browser that it (the target) doesn’t talk to “strange” web pages.

Realising that, I now understand the effect of all your suggestions.

Every day I learn something. Unfortunately it’s often what I’ve forgotten the week before. 😳

So, no, I’d not thought of a use case for PG doing CORS. 🤦‍♂️

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [May 9, 2025, 8:31am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/14 "2025-05-09T08:31:32Z")

</div>

You are not alone when it comes to the scary cors topic 🙂 All the best!

---

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [May 25, 2025, 12:00am UTC](https://forum.pinegrow.com/t/allow-cors-in-pinegrow-browser/73/15 "2025-05-25T00:00:43Z")

</div>

FWIW I got things working in my case. NOW I understand CORS a lot better. Security is such an inconvenience. 🤣

For anyone needing a bit more guidance, it’s too much to give a pre-emptive detailed breakdown here (plus I’ve forgotten most of the details) but the gist is the “secondary source” needs to specify which origins can have access, credentials (from the connecting page) are permitted, as well as various other things stipulated before the browser will permit a cross-origin connection.
