Private networking - CORS?

tiltowait
HOBBY

8 months ago

I connect to my backend via private networking. Currently, I've allowed all origins, but I'd like to tighten it up. I'm not sure if there's a correct/dynamic way to do this in Railway, though.

12fe90d4-42ca-4704-980b-e16da59696c0

0 Replies

8 months ago

You want to add CORS to the private network?


8 months ago

The private network is only accessible internally, there wouldn't be much point doing that cause no one else can access it anyway


tiltowait
HOBBY

8 months ago

Okay, thanks!


maddsua
HOBBY

8 months ago

Also, cors is absolutely pointless outside of browsers


tiltowait
HOBBY

8 months ago

This is inside a browser 👍 but question answered


8 months ago

how would someone's browser access something via the private network?


tiltowait
HOBBY

8 months ago

By making a POST request through JS. This whole thing was an issue of dev env not matching deployment. Like I said, it’s fixed now


8 months ago

Then I must be misunderstanding something, its a private network, someone's browser can not make a request to a private domain, it would not be a very private network if you could


tiltowait
HOBBY

8 months ago

It was my misunderstanding. I needed to disable CORS in local dev (allow my localhost, really). When I uploaded to railway, the page refused to render, citing mixed HTTP/HTTPS. I fixed that by using a reverse proxy and didn’t stop to think I was no longer doing a request from the browser in the first place 👍


8 months ago

well as long as it works now!