Third party application which I'm trying to integrate, asking to put a file inside a .well-known folder. how can I make that file accessible from URL? (example.com/.well-known/token.txt). site is deployed as a gitlab page. every attempt I tried gives 404 error.
If you put your ".well-known" folder inside the "static" folder it should get deployed to the root of your website as you expect.
Related
I am trying to deploy a Django REST framework API and ReactJS app to AWS Beanstalk.
The API works if I use Postman.
When I try to load the main.js I get the error:
http://django-env1.eba-ispw2cg9.us-west-2.elasticbeanstalk.com/static/frontend/main.js
404 Not Found
I have moved the static/frontend folder to the main folder.
How can I check the directory structure and where exactly to put the static folder so that the above URL will find it and load?
I am trying to use reactjs components in wordpress. I was following this tutorial -
https://jhinter.medium.com/using-react-based-web-components-in-wordpress-f0d4097aca38
Until I got stuck at the last part: I have added this as an html custom block to an empty page:
<script src="/apps/csptest-component/direflowBundle.js"></script>
<csptest-component></csptest-component>
The console prints out:
GET http://www.adminprofi.com/apps/csptest-component/direflowBundle.js net::ERR_ABORTED 404 (Not Found)
I have used FTP to put the file in a folder called apps/csptest-component in the root directory of the wordpress site and I can see that the upload was successful. Do I need to change the link that the src is pointing to? Any help is appreciated!
WordPress allows you to access files in the wp-content directory, so best practice would be to have a child theme setup and then you can upload your javascript to the directory: wp-content/themes/child/js and access it using http://www.adminprofi.com/wp-content/themes/child/js/direflowBundles.js .
It's recommended to use a child theme to ensure your script doesn't get removed when your theme is updated (plenty of resources on how to do this). Create a folder in here called js for tidiness.
EDIT: I think it will be easiest for you to upload your script to: /wp-content/themes/Divi/js folder, and then you can access your script like: <script src="http://www.adminprofi.com/wp-content/themes/Divi/js/yourscriptname.js"></script>
Using ReactJS I made a Build (reactJs static, npm build) and uploaded it to Google Cloud Storage Bucket, but getting a issue with the Path and Build folder files. The app (/static website) running but could not fetch the files from the bucket directory for eg the index.html & logo. (404 or 403 error )
Structure: Parent Bucket > Build folder (index.html, static folder & other files inside Build)
Any one have any suggestion on this. How to resolve this?
Do I need to create an app.yaml for GCS Bucket or any alternative?
I have gone through the article quite similar but for AppEngine instead of Bucket. https://medium.com/google-cloud/how-to-deploy-a-static-react-site-to-google-cloud-platform-55ff0bd0f509.
I have tried with app.yaml file but does not work for me.
I had exactly the same issue as mentioned by the OP. I am sharing my version of solution just in case anyone else ends up here.
As shown in the screenshots by OP, the 403 errors showed up for me because the URL of the static files in build/static folder was not correctly configured by the react-scripts build script.
Eg:
The url for index.html file was https://storage.googleapis.com/{bucket-name}/index.html.
However, when the page loaded, it requested files having url https://storage.googleapis.com/static/js/main.f555c3e0.chunk.js. It should rather be
https://storage.googleapis.com/{bucket-name}/static/js/main.f555c3e0.chunk.js
This is happening because by default react-scripts build assumes that your files will be served from root folder of your host.
To fix this add the following field in package.json of your project
"homepage": "https://storage.googleapis.com/{bucket-name}"
This tells the build script that it needs to add a relative path for serving static files.
For details please refer: https://create-react-app.dev/docs/deployment/#building-for-relative-paths
In order to set the routes of a static website stored in Google Cloud Storage, you need to assign a suffix to your objects. In other words, using suffixes is the intended way to configure your website. You can see more information in Hosting a static website document.
For your main index page you should set MainPageSuffix and for the not found page 404.html you should set NotFoundPage as suffix.
You can see more information on how to configure your static web here
I am getting a problem in deploying my app to the server. The problem is i have folders inside the webroot which points to the .css and .js files.
I was doing the basic cakephp function $this->Html->css('bootstrap') when my simple css files were in the css folder but now there are some other folders inside the webroot because of using the plugins for the frontend UI.
For this i have changed my url to like this $this->Html->css('/global/plugin/file')
Problem is on local it is working fine because of virtual host example.com but on live server i have domain like this 192.168.00.00/mysite so it go to the main directory to and link the ip 192.168.00.00 instead of going to 192.168.00.00/mysite.
Is there any good way to solve this and add the flexibility to the url so that my local and live will not be disturbed while i push my code through git?
Just removes '/' from $this->Html->css('/global/plugin/file') to below
<?php
$this->Html->css('global/plugin/file');
$this->Html->script('global/plugin/file'); //example loading file.js
?>
I already had an issue about this one including my JS and CSS inside a folder but when I removed '/' it solve my problem.
Confirm that their is a file.css inside plugin inside webroot\css\global\plugin\file.css windows path or LINUX path /webroot/css/global/plugin/file.css
I am uploading images to my applications storage/app/public/avatars directory. The files are uploading and are there in this folder - i have checked it. And loading the page shows the image as long as i am in my local pc. Then i moved the project to a shared hosting. Since then the images are not loading. From chrome console network tab i can see for the images laravel is throwing 404 error.
Here is what i have tried:
On the remote machine i recreated the symbolic link in my public folder as storage that is pointing to the storage/app/public folder.
Tried to copy and paste the image src directly into the browser - getting NotFoundException in RouteCollection.php
Cleared views, cache, config cache
Spent 5 hours trying to figure it out. Works fine on local pc. Just not on the shared hosting.
Desperately seeking help :(
After a bad night sleep of 4 hours i started again and found the problem. Very novice mistake, but can be ver hard to locate.
Here is what it is. I uploaded my laravel project folder to a shared hosting. Say my project name is myproject. This folder is at the same level as the public_html folder. Then i copied the contents of the myproject/public folder to the public_html folder.
As you know, you are supposed to create the symbolic link inside your public directory and the link should point to the storage/app/public directory (if you are using the public disk driver for your file storage). I did create the symbolic link inside the public folder, but at the wrong public folder. Since i copied the contents of public folder to the public_html folder, i should have created the symbolic link inside the public_html folder, not inside myproject/public folder!!
----public_html
---css
---js
---(other files etc. etc)
---storage <= this is where the symbolic link should be
----myproject
---public
---css
---js
---(other files etc. etc)
---storage <= not here!!
Very stupid of me.
btw, below is a tutorial of how to transfer a local laravel project to a shared hosting:
guide to deploy laravel 5 app on shared hosting