tjh
tjh
RRailway
Created by tjh on 9/11/2024 in #✋|help
Garbled response / Gzip issue?
I've been having an issue I can't get to the bottom of, so finally asking here. Context: - I have one Railway project, with several services: one frontend (NextJS, App Router, mainly SSR), one backend service (Django), a database (postgres) - Frontend tries to connect to the backend via private URL, and falls back to public URL if the initial connection fails (like when in client side, or during build) - Frontend calls various APIs, as you'd expect, APIs return JSON - There is no auth between services - The backend has django.middleware.gzip.GZipMiddleware and corsheaders.middleware.CorsMiddleware - The frontend has Cloudflare DNS, which I use to manage the domain - I'm using the new proxy Issue: - I made a change to remove pagination in one of my APIs, and removed the associated pagination logic on the frontend - After deploy, I get the attached error from my frontend during build Things I've tried: - Calling this API on the cmd line/postman works fine, and I get Content-Encoding = gzip in the response headers - Disabling GZipMiddleware in Django, get the same result - Mocking the response - returning hardcoded JSON - get same issue - When I make the hardcoded JSON smaller, it often works - this makes me think it's a Gzipping issue (which triggers when the response is >200 bytes) - Trying the legacy proxy - same result - Setting Accept-Encoding = gzip, deflate, br and Content-Type=application/json on the request in Next - Adding DEFAULT_RENDERER_CLASSES = rest_framework.renderers.JSONRenderer in Django - Praying c18400df-5dee-4fe7-bc56-a98db8d475bd
111 replies
RRailway
Created by tjh on 9/3/2024 in #✋|help
Frontend accessing backend - internal URL?
Hi folks I have a seperate FE and BE service - two different projects. The FE has an env var to locate the backend. Should I set this to the internal URL of the BE service that railway exposes? If so, should I prefix with http/https?
52 replies
RRailway
Created by tjh on 8/9/2024 in #✋|help
Cloudflare bare domain configuration
Hi folks, Have struggled to get my bare domain and www. working with Cloudflare, have read the Railway docs, and Cloudflare ones, and have tried many different settings, have ended up giving up, and now I'm here. Here are the latest steps I've followed, could you please tell me where I'm going wrong? 1. In Railway: add a custom domain for mydomain.com 2. In Cloudflare: add a CNAME for Name = @, target = <host>.up.railway.app -> the name of this DNS record automatically changes to mydomain.com 3. In Railway: add a custom domain for www.mydomain.com 4. In Cloudflare: add a CNAME for Name = www, target = <other_host>.up.railway.app After these steps, I can see Cloudflare proxy detected on both custom domains in Railway. Both my CNAME records are Proxied on Cloudflare. When I do this, the www. version works, the bare domain doesn't (I get 'this site can't be reached' in the browser). I've tried changing SSL/TLS mode from Full to Flexible in Cloudflare, still doesn't work. I've tried disabling Universal SSL/re-enabling, same thing. I only have one other DNS record, which is a TXT to auth with another service. Any help appreciated! Project ID: c18400df-5dee-4fe7-bc56-a98db8d475bd
76 replies
RRailway
Created by tjh on 7/31/2024 in #✋|help
Help with connecting to DB
Hi, I have a project with four services (python BE, redis, react FE, postgres). In my python project directory on local machine I've run: railway login and railway link, then linked to my backend service on railway. now running railway run python manage.py migrate stalls on connecting to the DB: do I need to export any env vars to make this connection work?
33 replies