Firebase Hosting Redirect to Sub-Folder - firebase

I have a project that use domain.app as primary domain, but I also want to redirect:
domain.com > domain.app/en/
domain.de > domain.app/de/
When I try this in firebase hosting interface, I get an error that this is not an valid URL:
This is ofc just an example domain to explain my problem. So... How I can solve this?

Related

Opening absolute urls in RedwoodJS - SSR

I have a RedwoodJS App with several routes.
It's very basic for now and I start the development server with yarn rw dev.
Now I have created some routes:
/ -> HomePage
/sign-in -> SignInPage
/register -> RegisterPage
I can call the routes internally via navigate which works fine. But I cannot call these routes via localhost:8910/register for example. I get a 404 error.
What do I have to do to make (almost) all routes callable directly with their absolute urls?
A late response to your question, but all the routes are managed in the Routes.tsx-file. In my example, I have a route to access the BikesPage-component (located in .../pages/Bike/BikesPage hence the naming BikeBikesPage).
So to ask your question, to make them callable by their absolute name, the name must be the same as the path. Hope that helped you or anyone coming here afterwards!

How to fix "Callback URL mismatch" NextJs Auth0 App

I am using Auth0 NextJs SDK for authentication in my NextJS App. I am following this tutorial https://auth0.com/blog/introducing-the-auth0-next-js-sdk/. In my local machine, everything works fine.
The configuration for Auth0 in my local server:
AUTH0_SECRET=XXXXX
AUTH0_BASE_URL=http://localhost:3000
AUTH0_ISSUER_BASE_URL=https://myappfakename.us.auth0.com
AUTH0_CLIENT_ID=XXXX
AUTH0_CLIENT_SECRET=XXXX
In the Auth0 Dashboard, I added the following URLs :
Allowed Callback URLs: http://localhost:3000/api/auth/callback
Allowed Logout URLs: http://localhost:3000/
My local app works locally fine.
I uploaded the app on Vercel. And changed the
AUTH0_BASE_URL=https://mysitefakename.vercel.app/
In Auth0 Dashboard, updated the following information:
Allowed Callback URLs: https://mysitefakename.vercel.app/api/auth/callback
Allowed Logout URLs: https://mysitefakename.vercel.app
I am getting the following error:
Oops!, something went wrong
Callback URL mismatch.
The provided redirect_uri is not in the list of allowed callback URLs.
Please go to the Application Settings page and make sure you are sending a valid callback url from your application
What changes I should make it works from Vercel as well?
You can try to check if vercel isn't changing the url when redirecting to auth0. Your configurations seems good to me. The error is very explicit though. I think a good option should be to verify that the redirect (if handled by vercel) is doing with the same url as auth0 expects.
And don't forget to add the url you're currently on when performing the callback. Are you in https://mysitefakename.vercel.app/api/auth/callback when the callback is executed? (call auth0).
you have to change your base url in the env.local file
AUTH0_BASE_URL=https://mysitefakename.vercel.app/
you can also make two more env files namely env.development and env.production and set different base urls for different cases so that the correct base url is automatically loaded depending on how ur web app is running.
You need to add handleLogin under api/auth/[...auth0].js and that will solve it:
import { handleAuth, handleLogin } from '#auth0/nextjs-auth0';
export default handleAuth({
async login(request, response) {
await handleLogin(request, response, {
returnTo: '/profile',
});
},
});
Don't forget to also add allowed callback url in [Auth0 Dashboard]: https://manage.auth0.com/dashboard for your hosted app for both local and hosted instance:
http://localhost:3000/api/auth/callback, https://*.vercel.app/api/auth/callback

Spring SAML 2.0 behind Nginx

I have a Spring-boot web app that uses SAML authentication provided by https://samltest.id/ .
It works fine on localhost but now I'm trying to put it on a server that has Nginx. Ngnix is configured so that any http request is redirected to https and https://myserver.company.com/myApp/ is sent to http://local_ip:local_port/ .
This cfg works fine if the application has no security but with SAML the result is: when I access the home page of the app I'm redirected to the login page (correct) and after successful login I'm redirected to https://myserver.company.com/saml/SSO/ instead of https://myserver.company.com/myApp/saml/SSO so Nginx gives a 404.
The metadata.xml contains:
<md:AssertionConsumerService Location="http://myserver.company.com:80/saml/SSO"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" isDefault="true" index="0"/>
<md:AssertionConsumerService Location="http://myserver.company.com:80/saml/SSO"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" index="1"/>
Note that URLs are http-based.
After a lot of Google search I have tried the following: I modified SAMLProcessingFilter configuration so that filterProcessesUrl property is "/myApp/saml/SSO" instead of the default value "/saml/SSO".
Now the metadata.xml contains:
<md:AssertionConsumerService Location="http://myserver.company.com:80/myApp/saml/SSO"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" isDefault="true" index="0"/>
<md:AssertionConsumerService Location="http://myserver.company.com:80/myApp/saml/SSO"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" index="1"/>
and after login I'm redirected to https://myserver.company.com/myApp/saml/SSO but this time I get a 404 from the web application instead of Nginx (the error page is different).
What am I missing?
UPDATE: the 3rd attempt
Restored SAMLProcessingFilter cfg to its default,
modified the context root of my app to be http://local_ip:local_port/myApp ,
modified Nginx cfg so that https://myserver.company.com/myApp/ maps
to http://local_ip:local_port/myApp (same context root),
set entityBaseURL property of MetadataGenerator to https://myserver.company.com/myApp ,
uploaded the new metadata.xml to https://samltest.id/ (now it contains https URLs).
Now, after a successful login I'm redirected to https://myserver.company.com/myApp/saml/SSO as expected but I get a 401 from the application with message "Authentication Failed: Incoming SAML message is invalid" and in the application log there is "org.opensaml.common.SAMLException: Unsupported request".
After several attempts I have found the solution.
No need to modify SAMLProcessingFilter or the context root. The key is to use SAMLContextProviderLB instead of SAMLContextProviderImpl as described in the chapter "Advanced configuration" of the manual. Also the entityBaseURL change already described in my question is necessary (it is in the manual too).

Godaddy Custom Domain | Firebase Website | Site can't be reached

I have purchased a domain from Godaddy let's say myCustomDomainName.com
I have created a project and deployed a web page in FireBase - https://home-myCustomDomainName.firebaseapp.com/
I have linked a custom domain in the project console
In GoDaddy the A records and TXT Records are also updated.
The site was up for a while. I could access my website using https://myCustomDomainName.com as well as https://www.myCustomDomainName.com
But now I keep getting Site can't be reached error. [I am however able to reach the site through firebase URL https://home-myCustomDomainName.firebaseapp.com/]
[]3
Even ping requests fail.
Please advice on what could be wrong and how to avoid this error.
Take out the www and the .com and use # or your sub host
e.g.
example.com:
Type: A, Value:#, IP: x.y.z.a
subdomain.example.com
Type: A, Name:subdomain, IP: x.y.z.a

Why am I getting a NoSuchBucket 404 error when forwarding www?

I'm trying to forward (with masking) www.theaxelrods.com to my Amazon S3 hosted static site at http://axelrods.s3-website-us-west-2.amazonaws.com.
For some reason theaxelrods.com forwards just fine, but www.theaxelrods.com does not. I even tried adding www as a subdomain and forwarding from there.
What could be causing this error?
404 Not Found
Code: NoSuchBucket
Message: The specified bucket does not exist
BucketName: www.theaxelrods.com
RequestId: 13C929CE3C10699B
HostId: fmi7K3bgEjRFxah/hxzyGx1FKy1Pte3+BK6TrNWcgy9KwsabLODfXZmGagnWkz3J
Bucketname are a global namespace on Amazon S3 and must be unique. Read more about this here.
So, you can create another Bucketname with www.theaxelrods.com, if you want to use it with www.*
I don`t try/needed it before... but I found this article, for routing with Route53.

Resources