Implicit callback returns nginx 404 not found

Hi,

I have setup OKTA login in React App, and everything works fine in local host. when the application is deployed in PCF, the application is redirected to OKTA login page as expected, but after entering the credentials it is redirecting back to application to the callback url, but it results in nginx 404 not found. the redirect url will be something like ‘https://app.domain.com/callback’. here the callback is not found whereas it works in localhost. any help/suggestion appreciated.

Regards,
Hari

Hi @rhkumar

The error occurs because /callback is a virtual path called by index.html and not a physical one.

In order to resolve this issue, can you please modify your nginx configuration to redirect all 404 requests to your index file? Here is an example

server {
   server_name your_IP domain.com www.domain.com;
   root /home/username/app/build;
   index index.html index.htm;
   location / {
   try_files $uri /index.html =404;
   }
}

Hi Dragos,
Thank you for the response. The issue got resolved by configuring “pushstate:enabled” in staticfile and pushed to PCF. https://docs.pivotal.io/pivotalcf/2-3/buildpacks/staticfile/index.html#configure

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.