If i have a laravel project in
c:\xampp\htdoc\proj -> http://localhost/proj
and public url
c:\xampp\htdoc\projpubl -> http://localhost/projpubl
Using the laravel livewire, the javascript url is
<script src="/livewire/livewire.js?id=83b555bb..." data-turbo-eval="false" data-turbolinks-eval="false"></script>
I want to do the url like:
<script src="http://localhost/projpubl/livewire/livewire.js?id=83..
How to do?
If you host your application in a path which is not the root in your domain, you need to publish the Livewire configuration and set the asset_base_url property. This is stated in the documentation.
To publish the config-file, run
php artisan livewire:publish --config
You will get a copy of the Livewire-config file in your project, located at config/livewire.php.
Find the asset_url property (aprox. line 57) and set it to
'asset_url' => '/projpubl'
Just to note, since I don't know how you've set your project up, anything outside the public directory in Laravel should never be accessible from any HTTP request.
Related
I am trying to expose Angular based UI application using Istio Gateway, in the angular application the static resources are placed in a sub path (eg : demo/assets) , but in the index.html of the angular application the base href path is given as , due to this getting a 404 error as the .js and css files are not available in root conext.
In istio is there any option available to modify the path in index.html from "/" to "demo/assets".
so that the static resources can be loaded properly from the sub path
Please help..
I tried providing re-write option of virtual service to /demo/assets, but on network tab in browser could see still the static resources ( JavaScript, css) are being still looke on the root conetxt where its not available leading to 404 error.
In Django, I have my login URL set to 'api/auth/login'. When given a username and password, it will log that user in. Running 'python manage.py runserver', it will put that URL at 'http://127.0.0.1:8000/api/auth/login'
However, my React project, when running 'yarn start' is at 'http://localhost:3000/' and giving it the extension 'api/auth/login', the url it attempts is 'http://localhost:3000/api/auth/login'.
This does not work, but if I replace the URL extension with 'http://127.0.0.1:8000/api/auth/login', the login works as expected.
How can I have the URLs work with my React app? Or is this not something that necessarily needs to be fixed? I do plan to host this project somewhere and am not yet sure how the URLs will work out..
One option is to set proxy in the package.json.
Second option is to set axois baseURL:
// add in your code before main component definition
// for example in App.js
import axios from "axios";
axios.defaults.baseURL = "http://127.0.0.1:8000";
I'm preferring the second approach. For doing production build it can be easily overwritten with an environment variable.
import axios from "axios";
axios.defaults.baseURL = REACT_APP_SERVER_URL
Remember to set the CORS headers in the Django server (I'm working on tutorial with an example how to do this).
You are hosting react application on another port that's why when you put a request without mentioning host, it gets appended to your current host i.e. 127.0.0.1:3000. I suggest you write "proxy": '127. 0.0.1:8000' in your package.json (refer https://create-react-app.dev/docs/proxying-api-requests-in-development/) and restart your react server or use full url of django server i.e. 127.0.0.1:8000/
I tried to generate a static web site with nuxt, but when i open the index.html file, it show an infinite load screen with this JS error :
fail to load element whose source is « file:///_nuxt/42185af33c638e7022a3.js ».
so, after i have search, i change router.base configuration by ./ and it throw this error :
This page could not be found
Back to the home page
but when i click on Back to the home page it showing my home page.
Anyone have an idea how to open index.html file from static build ?
i explain my project : i wish to run my app with Capacitor so i need static build work fine.
Thank by advance and my apologies for my bad english write.
I found two solution:
Solution 1 : Make your project to "universal" instead "single page app"
When you generate a static web app, it work fine when you run index.html. However, Capacitor display the page but don't recognize the router, so you can't switch page in your app.
Solution 2 : Set router in nuxt.config.js in spa
Add this configuration to nuxt.config.js :
router: {
base: './'
mode: 'hash'
}
it work when you open the index.html file in dist, but does not work with capacitor.
My request is therefore partially resolved.
Finally i have found my problem to run my app with Capacitor, Android dont like underscore.
In nuxt.config.js, just change _nuxt to nuxt
build: {
publicPath: '/nuxt/',
// ...
},
I am following https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
How would I get Ember to serve this url https://www.some-url.com/app-app-site-association
Note, app-app-site-association is a file. Unfortunately, Apple chose not to append an extension to this file.
Ideally, accessing this url should render:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "9F32916B95.foo.bar.baz",
"paths": ["*"]
}
]
}
}
The important think here to understand is that if you want to deliver a static file, may it be your /app-app-site-association or just an image on /something.jpg this has nothing to do with ember.
Ember runs in the browser. So the entire ember routing happens in the browser. Thats why you have to configure your webserver in a way that it serves the index.html file when he does not find a file.
So when you enter example.com/something this will trigger a HTTP GET example.com/something. Your webserver then should check if the file something exists, if yes it should respond with 200 OK and the content of that file.
If if does not find the file something it would normally respond with a 404 NOT FOUND. However when you use an SPA as ember you configure your webserver so it will never respond with 404 NOT FOUND but instead return 200 OK and the body of the index.html. (you can see an example configuration in the ember guides, but this will be different for different webservers)
This then will load your ember app (you've included the .js file in the index.html) and ember will check the current url and start the ember routing. This happens in the browser.
So if something wants to make an HTTP request and get the file app-app-site-association, it does probably not want to get your index.html and then run a browser to let ember do anything. It just wants the file directly from your webserver. So your webserver must directly respond with 200 OK and the content of that file. And it will probably do this as I mentioned above if that file just exists.
Now ember projects have a public folder. If you want to have some files alongside your ember application that should just be served by your webserver this is the right place. Whatever you put in it will just be copied to the dist folder. This means when you then deploy your dist folder you will also deploy the file.
However be careful about your webserver configuration. Because the file has no ending it will probably be served as text/plain. If you want it to be served as application/json you need to configure your webserver accordingly.
I am using JA_Orisite template of joomla2.5 for my client, and unable to load jquery file "//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"(needed for menu and article scrollings, etc), This file was being loaded on localhost, when I transfered the site using akeeba backup and recovery process, after installation on server I am unable to load jquery.
Surprisingly, I was having file permission issues on server, once I set 777 to all the files of my site, Jquery file was also working properly.
As the first server is not providing me the expected speed and service, I have transfered the site to other hosting server, which is now giving the same problem of jquery, On this server too I tried to set the permissions to 777, and yet unable to load jquery files.
Rather than importing it from Google, you could always import a local version like so:
<?php
// load jQuery, if not loaded before
if(!JFactory::getApplication()->get('jquery')){
JFactory::getApplication()->set('jquery',true);
$document = JFactory::getDocument();
$document->addScript(JURI::root() . "templates/template_name/js/jquery.js");
}
?>