<@U04UQ68083H> I'm using a self-hosted instance of...
# ory-copilot
b
@chilly-king-10285 I'm using a self-hosted instance of Ory Kratos (
<http://localhost:9080/kratos/self-service/>
). When I try to resend a verification code, everything works as expected. However, if the verification flow has timed out, the
updateVerificationFlow
function redirects to:
Copy code
<https://localhost:4433/self-service/verification/flows?id=24ae8c74-c29e-480a-93f2-4444ed3be292>
I'm not sure why it's redirecting to
localhost:4433
instead of my expected URL. How can I override this behavior in the configuration? My client SDK configuration
Copy code
const ory = new FrontendApi(
	new Configuration({
		basePath: "<http://localhost:9080/kratos>",
		baseOptions: {
			withCredentials: true,
		},
	})
);
b
A message from kapa.ai
To address your issue with the redirection URL in your self-hosted Ory Kratos instance, you need to configure the
selfservice.flows.verification.ui_url
setting in your Kratos configuration. This setting determines where Kratos redirects for verification flows. Here's how you can override this behavior: 1. In your Kratos configuration file (usually
kratos.yml
), add or modify the following section:
Copy code
yaml selfservice:   flows:     verification:       ui_url: <http://localhost:9080/your-verification-ui-path>
Replace
<http://localhost:9080/your-verification-ui-path>
with the actual URL where your verification UI is hosted. 2. You can also set this configuration using an environment variable:
Copy code
SELFSERVICE_FLOWS_VERIFICATION_UI_URL=<http://localhost:9080/your-verification-ui-path>
By setting this configuration, you're telling Kratos where to redirect for verification flows, which should prevent the unexpected redirect to
localhost:4433
. The reason you're seeing a redirect to
localhost:4433
is likely because this is the default value when the
ui_url
is not explicitly set in your configuration. Kratos uses this as a fallback URL for the verification UI. For more details on configuring the verification flow UI URL, you can refer to the [Ory Kratos Fallback Documentation](https://www.ory.sh/docs/kratos/fallback/verification). Remember to restart your Kratos instance after making changes to the configuration for them to take effect.
b
@chilly-king-10285 I have, this set up but it is port 4455 not 4433
Copy code
verification:
      enabled: true
      ui_url: <http://127.0.0.1:4455/verification>
      lifespan: 10s
      use: code
b
A message from kapa.ai
Based on the configuration you've provided, it seems you have already set up the verification UI URL correctly. The issue you're experiencing with the redirection to port 4433 instead of 4455 might be related to other parts of your Ory Kratos configuration or the setup of your reverse proxy. Let's review a few potential solutions: 1. Check your base URL configuration: Make sure your
serve.public.base_url
is set correctly in your Kratos configuration. It should point to the URL where Kratos is publicly accessible. For example:
Copy code
yaml    serve:      public:        base_url: <http://127.0.0.1:4455/>
This is mentioned in the [Ory Kratos deployment guide](https://www.ory.sh/docs/kratos/guides/deploy-kratos-example#configure-user-interface). 2. Verify your Nginx configuration: If you're using Nginx as a reverse proxy, ensure that it's configured correctly to forward requests to Kratos. Here's an example of how it might look:
Copy code
nginx    location /auth {      rewrite /auth/(.*) /$1  break;      proxy_pass <http://127.0.0.1:4455;>      proxy_redirect          off;      proxy_set_header        Host            $host;      proxy_set_header        X-Real-IP       $remote_addr;      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;    }
This is based on the configuration example in the [Ory Kratos deployment guide](https://www.ory.sh/docs/kratos/guides/deploy-kratos-example#configure-user-interface). 3. Check for any overriding configurations: Make sure there are no other configuration settings or environment variables that might be overriding your
ui_url
setting. 4. Verify the Ory Oathkeeper configuration: If you're using Ory Oathkeeper as an Identity and Access Proxy, ensure that it's configured correctly. The [Ory Kratos Zero Trust guide](https://www.ory.sh/docs/kratos/guides/zero-trust-iap-proxy-identity-access-proxy#running-ory-kratos-and-the-ory-oathkeeper-identity-and-access-proxy) provides information on how to set this up. If you've verified all these settings and the issue persists, it might be helpful to review your entire Kratos configuration and the setup of any reverse proxies or identity access proxies you're using. The unexpected redirection could be happening at a different layer of your infrastructure. Remember to restart your Kratos service after making any configuration changes for them to take effect.