-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirecting to a subdomain after post request #99
Comments
@drfraker have you set your SESSION_DOMAIN to something like Also what did you add in the |
@sicsol Hey Thanks for the response. I added this to the bootstrap/app.php file, just as a way to debug the issue.
Where would one set the SESSION_DOMAIN value? I've never heard of that before. |
@drfraker it's in the |
@drfraker Did you get this figured out? This is an annoying problem that really has to do more with the fact that you're making xhr requests than Inertia.js requests. Have you considered simply making these particular signup requests using a full page visit? |
@reinink Thanks for replying, that (full page visit) is what we ended up going with. |
I face this issue when dealing with a payment processor (mollie-cashier) - is it possible to redirect the user to the payment page if the form doesn't fail? A full page visit isn't pretty if the form fails for example... 🤔 |
Another option here is to return a 409 response with the |
Hi, i don't understand how i can use this to redirect to another page, can you explain to me please? |
Hi @kadusalles 👋 , All you need to do is either use an inertia link, a form request method (such as Then, on the back-end itself, make sure that the response to that request is what @reinink described in his comment. Once Inertia that response, it should automatically redirect the browser to the location you specified in the Hope this helps! |
Redirecting to external sites server-side, from within an Inertia request, is now possible using the new Inertia "location" method: // Laravel
return Inertia::location('https://www.google.com'); And this is coming to the Ruby adapter shortly (inertiajs/inertia-rails#48). inertia_location('http://google.com') |
We have a site that switches subdomains a lot... so we wrapped the <template>
<inertia-link :href="this.href" @click="visitLink">
<slot/>
</inertia-link>
</template>
<script>
export default {
name: 'SubdomainLink',
props: ['href'],
computed: {
currentSubdomain() {
return window.location.host.split('.')[1] ? window.location.host.split('.')[0] : null;
},
linkedSubdomain() {
let linkedSubdomain = this.href.split('.')[1] ? this.href.split('.')[0] : null;
return linkedSubdomain.replace('https://', '');
}
},
methods: {
visitLink() {
if (this.currentSubdomain !== this.linkedSubdomain) {
// Invalid subdomain link, force entire page visit/hard refresh
window.location.href = this.href;
}
}
}
};
</script> |
how about redirecting to a subdomain on the same site? I can't seem to solve this issue. |
I'm writing an app using a multi-tenant architecture. When a new customer signs up they are in the central part of the app. When they submit the registration form, we process payment, set up their tenancy and new database, add the admin user to their users table, log in the admin user and redirect to their dashboard page on their subdomain. When I do this using regular laravel views it works. However, when I'm trying it with inertia I get a cors error in the console. Is there some way I'm not seeing in the docs that explains how to do this?
Workflow overview:
like so:
return redirect()->to('acme.example.com/app');
This is the cors error I see:
Access to XMLHttpRequest at 'http://foo.example.test/app/login' (redirected from 'http://example.test/register') from origin 'http://example.test' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
The text was updated successfully, but these errors were encountered: