After login i always getting the referer ulr is same but the redirect url is not the one which i used. And the url on the url bar is hashed but not redirected to this after log in.
Related
I developed a contact form for my site and it is working and redirects to another url inside my domain when it is sent (for example lets say domain.com/sent). The thing is, if someone by chance decides to access the url domain.com/sent directly, it can be accessed like if he had submitted the form and was redirected there. I also have configured a 404 error custom page for any other page outside the existing ones, is there any way of disabling the domain.com/sent external access and redirecting to the error 404 page and keeping the sent page only for the users who really submitted the form?
Have the response to the POST request to the form handler set a cookie.
Have the handler for /sent test for that cookie and:
If it is set:
Delete the cookie
Display the sent page
If it not send:
Do something different such as displaying an error or redirecting
I've noticed in Chrome's dev tools, when you make a request to a url that ends up returning you a 301 redirect the following happens:
The original request (a POST in this example) is written to the Network tab
The server returns a 301 redirect to a different URL
The original request details in the Network tab are overwritten with the redirect request, which is a GET request to the redirect URL
You can see the original request briefly before it is overwritten by the redirect. Is there anyway to preserve the original request details in the Network tab?
Update:
Here's a video of the behavior.
You'll see when I hit the "Connect" button a new entry is added to the list of requests (to "/acl?apiKey=[whatever]"). When the server returns a redirect (to "/redirect?code=[whatever]") that requests overwrites the original request in devtools, making it impossible to see the details of that original request.
after the user has registered, they will be redirected to a html page containing ((We have sent a conformation email to your email address please confirm it to activate your account.)).
what should I replace ((?)) with ?
The named url which you have mentioned in urls.py
confirm
If you have not mentioned named url yet you can check how I have used name in below url.
path('email/confirm/', views.some_view, name='confirm_url'),
In above case your '??' should look as below.
confirm
If you want to redirect to external url .
website
I have a webpage /example with a form that has action="/submit". submit will process the data sent to the server, and return a 302 redirect back to /example.
I would like to have (the second) /example display some sort of response to the user based on what the user submits to /submit, such as an indication of success or failure.
Sending a 302 redirect doesn't seem to have any way to tell the client to send any additional message to /example, so the server is unable to determine if it should indicate success or failure when fetching /example for the client.
I could append the success or failure message to the 302 redirect url, i.e. redirect to /example?message=Succeeded, but that url will stay on the user's address bar as long as he continues to browse my /example page, which isn't very nice.
I could change the form to have action="/example", but I have multiple forms on the /example page, so I would need to use hidden <input> elements or other means to distinguish the requests submitted by the user to /example. This seems to be more of a hack than a proper solution.
What is the usual way this can be accomplished?
I am trying to build a front end application which will an input text box.
When a user enters an URL in the text field(ex www.google.com, wwww.facebook.com, www.linked.com, etc..), the web app should tell the user whether if the provided address has a re-direction?
Can it be done from ajax?
You can send a GET request to the URL and see what it returns.
Every HTTP response will come with a status code.
You can see the full list of HTTP status codes here: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
A 301 means the URL has a permanent redirect and a 302 means there is a temporary redirect.