I have a simple request.
I need to these routes
/v1/devices/*
and redirect them to
/v1/*
I have set this up
But it's looking like it's not hitting these routes at all.
We have setup a new API endpoint for the devices to connect to, we can only change the hostname on the devices, so we need to redirect those routes to the new routes. I would prefer not to have to do that in code if I don't have to.
What am I doing wrong?
So thanks to #guillaume it was an easy fix.
Updating my Path prefix rewrite from /v1/* to /v1/ this has allowed the routes to come in the correct path as expected.
Related
I’m not sure if “catch all” would be the correct term here, but how do you block access to page routes (not API) including any slug that comes after the first slug. Also, I’m using Nextjs and NextAuth
Ie. Allow all-auth-users access but not public access to:
/account/userid
Ie. Allow only logged in session user access to:
/account/userid/actions
Ie. Still only allow logged in session user access to:
/account/userid/actions/create
The only way I can think of doing this is by detecting router paths via useRouter and then adding specific wrapper components with session logic around /account/userid/ and different session logic for around /account/userid/actions.
Is this the correct/best way to go about this?
You can configure a middleware.ts file and define which routes you wish users to have access to. More on nextjs middleware here https://nextjs.org/docs/advanced-features/middleware. And as for authorization of each route via middleware, you can read more about that here https://next-auth.js.org/configuration/nextjs
I'm testing the Oauth connection in my local host. I need to specific redirection URL so I gave the following URL there.
http://localhost:3001/succesful/
On successful authentication, it gets redirected and appends with code and scope like this.
http://localhost:3001/succesful/?code=asasasa&scope=asasas
But for some reason, my URL is not loading. I have added route like this.
<ProtectedRoute path="/succesful/:code?" component={Connection}/>
I'm new to programming, not able to understand what I'm doing wrong
How I fixed it: I changed every URL in developer console to https:// even though I don't have it setup
I have certain knowledge using Bakcbone.js, and my backend is Restlet Java, but have no idea regarding user authentication
I have built a single-page web app using them, but now the problem arises that, what I am going to do after user login? There are pages that can be viewed by both logged in and not logged in user, and logged in users should be able to see additional content.
By default the page uses http, but after user Login, suppose an Ajax Post, how do I switch entire Backbone App from http to https? And suppose user logs out, how do I switch back?
Are there any convient ways just to switch all my routes in Router, Url/Urlroots in Collection/Model between Http and Https? (using relative address)
Can I deal with this using Server Redirect..and how can I do that, doesn't that make Http and Https sections completely separated like two apps?
woha - that's a lot stuff you are thinking ..half of which doesn't even belong to Backbone's scope.
Let's split this up:
but have no idea regarding user authentication
read this. I just answered this yesterday.
what I am going to do after user login?
the normal pattern here is that login is usually one page. If the user successfully logs in then she is redirected to another page which has all the Backbone stuff in it e.g. take a look at a backbone app classdojo.com . Login is simple HTML with no fancy stuff. Once user logs in, she navigates to a single-page app with all heavy client side.
Are there any convient ways just to switch all my routes in Router, Url/Urlroots in Collection/Model between Http and Https? (using relative address)
Backbone Router ONLY looks at the route which comes '#' e.g. in example.com/user#details Backbone router will only navigate based on #details . It has nothing to do with your http protocol.
Your Url/Urlroots can be relative or absolute both. So you can specify full URL with http protocol in them.
I am using google app engine with python and webapp2, and i can't find the way just to redirect to an external web site using an absolute uri.
For example:
class Landing(BaseHandler):
def get(self):
self.render("landing.html")
def post(self):
name=self.request.get("name")
if name == "yes"
self.redirect("/")
else:
self.redirect("http://example.com") **This is the problem as I want to redirect to an absolute url.
The self.redirect always redirects to a relative url. How could I do a redirection to an absolute url? I think it has to be easy but I can't find the way.
Works fine for me and does not only redirect to a relative url. Please check your config of your host, browser and caching.
GAE just redirected me to example.com using it on my dev and production server
Take care though that example.com redirects to http://www.iana.org/domains/example/
That might be confusing you.
Try using eg self.redirect("http://www.facebook.com"). That will redirect you to facebook. Simple.
Also.. I think I may have been bitten by the fact that there is no return in your code - so even after you've called the self.redirect(...) bit, if you write anything else to self, that may mess up your redirect.
I have the following problem.
A reverse proxy is used to establish a secure (https) connection to a server in an internal network. So the address is https://<url>. If I am now on my login page (https://<url>/users/login) and hit "submit" the https is removed (by the loginRedirect) and it's trying to connect to the url via http. Of course that is running into an timeout but the users is logged in. If the user is then accessing a page directly it's working.
Once the users is on the page he can do everything that is necessary and the other links are showing up with https as expected.
How can I avoid that the loginRedirect is removing the https? One solution is to use simply $this->redirect('<url>'); instead of $this->redirect($this->Auth->redirect()); but then I would lose the handling of direct links if somebody is not logged in and tries to access a specific part of the page that requires authentication.
I just got help in the CakePHP lighthouse forum and I would like to share the solution with you. It was actually pretty easy. In a reverse proxy scenario you have to edit the bootstrap.php (in the config folder) and add the following base URL:
define('FULL_BASE_URL','https://your base url');