Angel One API – Railway Deployment Issue (Redirect & Layout)
madfortech
FREEOP

2 months ago

Hi everyone wave emoji
I’m integrating Angel One (SmartAPI) with a Laravel app deployed on Railway.

Current issues I’m facing:

  • After successful Angel One login, redirect to /callback / /angel/profile is not working properly

  • Layout / session breaks on Railway (works fine locally)

  • Suspected causes: APP_URL, SESSION_DOMAIN, HTTPS cookies, or Railway proxy config

Setup details:

  • Laravel (PHP 8.4)

  • Railway deployment (port 8080)

  • Angel One Publisher Login flow (auth_token, feed_token)

  • Sessions stored via Laravel session driver

If anyone has experience with:

  • Angel One SmartAPI

  • OAuth-style redirects on Railway

  • Laravel session issues behind HTTPS proxies

Your guidance would really help pray emoji
Thanks in advance!

$10 Bounty

1 Replies

yusufmo1
PRO

2 months ago

this is a laravel behind proxy issue. railway terminates SSL at their edge so your app sees http internally but needs to generate https urls and secure cookies. you need to configure trusted proxies and fix your session/cookie settings.

in your app/Http/Middleware/TrustProxies.php, set protected $proxies = '*'; to trust all proxies (railway uses dynamic IPs). then in your .env set: APP_URL=https://yourdomain.up.railway.app, SESSION_SECURE_COOKIE=true, SESSION_SAME_SITE=lax (or none if cross domain), and remove SESSION_DOMAIN entirely so laravel uses the request host. also make sure SANCTUM_STATEFUL_DOMAINS includes your domain if you're using sanctum.

the oauth redirect issue is likely because laravel generates http callback urls instead of https. with trusted proxies configured properly, url() and redirect() helpers will use the X-Forwarded-Proto header and generate https urls. if it still breaks, you can force https in your AppServiceProvider boot method with \URL::forceScheme('https');


Loading...