SSL cert not valid?

Hi! i'm having a problem with my SSL cert showing up as not valid.. it's for api.borrachopescador.org
91 Replies
Percy
Percy2y ago
Project ID: ecf31465-4b53-4a0a-9ffd-f64b1a514be0
spacemaker13
spacemaker13OP2y ago
ecf31465-4b53-4a0a-9ffd-f64b1a514be0 Is there something else I need to do to configure SSL? I have added the CNAME record for api. to go daddy
Brody
Brody2y ago
show me the domains you have in the railway service
spacemaker13
spacemaker13OP2y ago
Brody
Brody2y ago
^
spacemaker13
spacemaker13OP2y ago
spacemaker13
spacemaker13OP2y ago
Is it something I just need to wait on? I think I set it up a few days ago.
Brody
Brody2y ago
you have not generated a railway domain
spacemaker13
spacemaker13OP2y ago
I had one earlier, same problem. I deleted it in case that was the issue i'll generate another one though
spacemaker13
spacemaker13OP2y ago
It's created now
spacemaker13
spacemaker13OP2y ago
spacemaker13
spacemaker13OP2y ago
The domain is definitely working, just not under ssl
Brody
Brody2y ago
set the cname value for the custom domain to bp-development-production.up.railway.app
spacemaker13
spacemaker13OP2y ago
alrighty, i'll give that a go. Thanks Brody
Brody
Brody2y ago
what do you have your ssl/tls node set to?
spacemaker13
spacemaker13OP2y ago
Not sure what you mean by this question. I have updated the CNAME record and am still getting an invalid ssl cert
Brody
Brody2y ago
in cloudflare, what do you have your ssl/tls mode set to?
spacemaker13
spacemaker13OP2y ago
we don't use cloudflare our domain is hosted on godaddy
Brody
Brody2y ago
Brody
Brody2y ago
your nameservers for that subdomain are set to cloudflares
spacemaker13
spacemaker13OP2y ago
Perhaps godaddy uses them by default?
Brody
Brody2y ago
no, godaddy has their own
Brody
Brody2y ago
Brody
Brody2y ago
your root domain has godaddys name servers can you figure out what is going on here?
spacemaker13
spacemaker13OP2y ago
I am pointing it to the domain that was appropriated by railway. getting credentials now, i'll get to the bottom of it soon I'm also having a cors issue, which is a bit strange because it doesn't happen anywhere else. Is there something I need to do with railway in order to effect my cors policies? or do all headers get passed along by default?
Brody
Brody2y ago
well you are getting cert invalid, i think theres bigger issues than cors at the moment one thing at a time, let me know when you have more information about the nameever stuff
ThallesComH
ThallesComH2y ago
i think that's the name servers of railway
Brody
Brody2y ago
not quite how that works
ThallesComH
ThallesComH2y ago
I don't think he shouldn't add the domain generated by Railway. instead we should add the dns record provided by Railway when trying to add a custom domain
ThallesComH
ThallesComH2y ago
well, that's how my custom domain is set up and give it a minute to Railway generate all the ssl things
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ThallesComH
ThallesComH2y ago
Yeah, he should remove the "bp-development-production.up.railway.app" CNAME and use the custom domain provided one
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
ThallesComH
ThallesComH2y ago
well, mine didn't asked for that Ok, remove the api dns record and go through the process of adding new custom domain again
spacemaker13
spacemaker13OP2y ago
ThallesComH
ThallesComH2y ago
and then wait for a bit, Railway will take care of the SSL
spacemaker13
spacemaker13OP2y ago
alrighty it's been added, now we 🕐
ThallesComH
ThallesComH2y ago
on my machine is already working
spacemaker13
spacemaker13OP2y ago
not sure about the challenge? is this in the docs somewhere? Do i still need to do that
Brody
Brody2y ago
works for me too
spacemaker13
spacemaker13OP2y ago
mine too you guys rock thank you
ThallesComH
ThallesComH2y ago
No, Railway takes care of SSL challenges
spacemaker13
spacemaker13OP2y ago
on to the cors problem lol
ThallesComH
ThallesComH2y ago
Using nestjs?
spacemaker13
spacemaker13OP2y ago
yep
ThallesComH
ThallesComH2y ago
then just enable cors app.enableCors in main.ts
spacemaker13
spacemaker13OP2y ago
app.enableCors({ credentials: true, origin: process.env.FRONTEND_URL || 'http://localhost:3333', }); I've got that I'm using jwt in http-cookies
ThallesComH
ThallesComH2y ago
what's frontend_url? the value
spacemaker13
spacemaker13OP2y ago
Brody
Brody2y ago
remove https://
ThallesComH
ThallesComH2y ago
and it should be api too
spacemaker13
spacemaker13OP2y ago
No the frontend is at base. API is at api.bo...
ThallesComH
ThallesComH2y ago
or use a regex like what i do /\.borrachopescador\.org$/
spacemaker13
spacemaker13OP2y ago
show me 🙏 oh... Ok. I can try that
Brody
Brody2y ago
this does not match borrachopescador.org
ThallesComH
ThallesComH2y ago
well, mine is exactly like that and it's been working
Brody
Brody2y ago
not everyones setup is the same
ThallesComH
ThallesComH2y ago
well, let him give it a try, if doesn't work we'll see
spacemaker13
spacemaker13OP2y ago
spacemaker13
spacemaker13OP2y ago
I just hard codded the borrachopescador.org i'll move to the regex and see redeploying. will have an answer in about 2 min
ThallesComH
ThallesComH2y ago
ok
spacemaker13
spacemaker13OP2y ago
p.s. Railway is dope
ThallesComH
ThallesComH2y ago
👆 🧠 i've used kubernetes before Railway, never going back thank god
spacemaker13
spacemaker13OP2y ago
ThallesComH
ThallesComH2y ago
send me a screenshot of your app.enableCors
spacemaker13
spacemaker13OP2y ago
spacemaker13
spacemaker13OP2y ago
spacemaker13
spacemaker13OP2y ago
ThallesComH
ThallesComH2y ago
where did you put the regex?
spacemaker13
spacemaker13OP2y ago
spacemaker13
spacemaker13OP2y ago
I also logged the url variable on the server I put it in railway. that's the environment variables section
ThallesComH
ThallesComH2y ago
i don't think you should put the regexp as a string mine is actually a javascript regex
spacemaker13
spacemaker13OP2y ago
oh I see what you're saying hm...
ThallesComH
ThallesComH2y ago
just place it in the origin and it should work
Brody
Brody2y ago
just use the railway provided variable RAILWAY_STATIC_URL as the origin
spacemaker13
spacemaker13OP2y ago
const re = new RegExp("ab+c");
ThallesComH
ThallesComH2y ago
take mine as an example
spacemaker13
spacemaker13OP2y ago
yea.. but it's an environent variable, and it's going to be passed as a string so i need to first set that string as a regex variable and then use the variable
ThallesComH
ThallesComH2y ago
that's probably the problem, as you see in the error message, it shows the regex as a string so nestjs is taking that regex as a domain and not a regex to handle it
spacemaker13
spacemaker13OP2y ago
so.. I went straight to
Brody
Brody2y ago
what status code do you get from that request
spacemaker13
spacemaker13OP2y ago
spacemaker13
spacemaker13OP2y ago
boys... I think I got it Thank you for your time. you guys are rockstars
Brody
Brody2y ago
well dont leave us hanging, what was the problem
spacemaker13
spacemaker13OP2y ago
Haha I user the regex expression from the docs of cors() /.borrachopescador.org$/ and I added the actual domain as a string. not sure which one is actually making it work, but i'm not touching it 🤞 So... Do you guys have a recommendation on running them on the same domain? I'm now running into an issue with incognito mode and safari not working due to third-party cookies in CORS... I need to serve them both from the same domain.... sigh.... How is this best achieved since railway is handling the routing? normally I would set up docker and have NGINX sending requests as a reverse proxy in order for both backend and frontend requests to hit the same url, but i'm not sure if this is a great solution for railway. Also I'd have to then manage a monorepo in order to have both codebases running in CI/CD.. this seems less than optimal. Is there something I'm missing on having a seperate SPA and backend running on the same domain?
Brody
Brody2y ago
if the frontend is in the format: domain.com and the backend is api.domain.com would this setup still run into third party cookie issues?
spacemaker13
spacemaker13OP2y ago
yea.. that's how I have it, and to my knowledge that won't work under Same-Site I guess I could try it...
Brody
Brody2y ago
wouldn't you just need to set a cookie for api.domain.com, why do you need to set the cookie for the frontend domain?
spacemaker13
spacemaker13OP2y ago
I may be wrong.. they may both be same-site... I will give it a shot.
Brody
Brody2y ago
I'm not sure, I don't do cookie stuff
spacemaker13
spacemaker13OP2y ago
I am passing JWT tokens in http-only cookies. For authentication
Want results from more Discord servers?
Add your server