Skip to content

allow_mixed_web directive in starter.ini #109

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

Closed
apolopena opened this issue Apr 17, 2021 · 0 comments
Closed

allow_mixed_web directive in starter.ini #109

apolopena opened this issue Apr 17, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request passed-dev-qa Optional state. Use this when QAing other peoples fixes in another branch.ready to be merged to main

Comments

@apolopena
Copy link
Owner

Problems this feature will solve

  • Mixed content won't work in an iframe such as in the vscode Simple Browser or Gitpod Theia's preview
  • Some servers such as php dev server (php artisan serve too) will not use the ASSET_URL in .env resulting in broken links.

Proposed Solution

Add a default directive (on by default) named allow_mixed_web that:

  • Allows for mixed content on the same domain by converting all http requests to https in routes/web.php
  • Forces all web routed urls to use the value set for APP_URL in .env

Constraints and Assumptions

If the directive is turned on then Inject this code snippet into routes/web.php

/**
 * BEGIN: Injected from .gp/snippets/laravel/allow-mixed-web.snippet
 */

$url = config('app.url');
resolve(\Illuminate\Routing\UrlGenerator::class)->forceRootUrl($url);
resolve(\Illuminate\Routing\UrlGenerator::class)->forceScheme('https');

 /**
 * END: Injected from .gp/snippets/laravel/allow-mixed-web.snippet
 */

Alternatives or Workarounds

Configure yourself

Additional context

Warn the user to disable this default only if they know what they are doing.

@apolopena apolopena added the enhancement New feature or request label Apr 17, 2021
@apolopena apolopena self-assigned this Apr 17, 2021
@apolopena apolopena changed the title allow_mixed_web starter.ini config allow_mixed_web directive in starter.ini Apr 17, 2021
@apolopena apolopena added passed-dev-qa Optional state. Use this when QAing other peoples fixes in another branch.ready to be merged to main and removed in-dev-qa labels Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request passed-dev-qa Optional state. Use this when QAing other peoples fixes in another branch.ready to be merged to main
Projects
None yet
Development

No branches or pull requests

1 participant