# Okta redirectUrl throws 404 error in tomcat

**URL:** <https://devforum.okta.com/t/okta-redirecturl-throws-404-error-in-tomcat/27644>\
**Category:** OAuth/OIDC\
**Created:** [April 9, 2024, 3:38pm UTC](https://devforum.okta.com/t/okta-redirecturl-throws-404-error-in-tomcat/27644 "2024-04-09T15:38:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shka1007](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Shka1007](https://devforum.okta.com/u/Shka1007)\
**Post date:** [April 9, 2024, 3:38pm UTC](https://devforum.okta.com/t/okta-redirecturl-throws-404-error-in-tomcat/27644/1 "2024-04-09T15:38:56Z")

</div>

I have an application with Angular + JSP and both of them been kept in one context directory of tomcat.

The application is in tomcat **webapps/projectFolder** (Angular + JSP i.e. JSP files are kept in nested folder of projectFolder)

The OKTA configuration & authentication is working fine as I can see the token been passed along with redirectUrl but the tomcat throws error of 404.

The redirectUrl is **[https://website.com/projectFolder/login/callback](https://website.com/projectFolder/login/callback)**

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/e/e64b35dceed53bb6291cc7fd2849afa09af1affe.png)

We tried to update with different VirtualHost configuration for eg, Alias, Granting all permission to directory, Rewrite rules too but none of them worked. So we are bit confused & blocked on it.

Can we get help?

---

<div class="post-metadata">

**Author:** ![Shka1007](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Shka1007](https://devforum.okta.com/u/Shka1007)\
**Post date:** [April 12, 2024, 5:49am UTC](https://devforum.okta.com/t/okta-redirecturl-throws-404-error-in-tomcat/27644/2 "2024-04-12T05:49:02Z")

</div>

Hello Team,

Do we have any update on the issue?

We tried with below rewrite rules the default once as per angular documentation.

```auto
RewriteEngine On
RewriteBase /projectFolder/

# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html

```

-Thanks

---

<div class="post-metadata">

**Author:** ![krishna](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@krishna](https://devforum.okta.com/u/krishna)\
**Post date:** [April 15, 2024, 9:29am UTC](https://devforum.okta.com/t/okta-redirecturl-throws-404-error-in-tomcat/27644/3 "2024-04-15T09:29:42Z")

</div>

This looks like a servlet issue from Tomcat rather than Okta.

1. Check the servlet code if you are handling “/login/callback”?
2. Check for URL mapping in servelet classes.
3. Since these URLs are case-sensitive, check your server code if you missed a case or a character.
4. Check the mappings in your.xml (web.xml, pom…etc.) configuration files. (“logout/callback”)
5. Check if your index.html is in the right folder ?

This definately looks like a path error, either configured wrongly / or missing from expected location.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [May 15, 2024, 9:30am UTC](https://devforum.okta.com/t/okta-redirecturl-throws-404-error-in-tomcat/27644/4 "2024-05-15T09:30:12Z")

</div>

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