AWS amplify not rendering image using the dynamic online url while local build render image correctly - vuejs3

Locally I got:
The deployed version I got:
I'm not sure why the service URL is added before the image URL.
And the wired thing is the dynamic url path does not load correctly while the static path works well.
I guess it might have to do with the path redirection so below is my setting:

Related

How to access html file inside iframe in production

I am creating a web app where, this app will generate a .html file in public/ directory. And after that i want to show that generated html file on a page using iframe .
I am using NextJS for this task. I have configured next.config.js for rewrites but getting 404 error. I am using Railway for hosting. Since in Vercel we can not access filesystem here.
Instead of generating html dynamically, if I upload that .html file, then i can access that file using iframe in production.
I think we can not access those files which were not available during build process. (this is my guess , maybe wrong)
How can I solve this problem or should I use another framework ?
Thanks
Since I was accessing .html files (i.e <iframe src="path-to-file"></iframe>) which were not available during build process, that's why i was getting 404 error.
So I did the following thing:
suppose I want to do this <iframe src="/pdf/page01.xhtml"></iframe> where file location is in public/pdf/page01.xhtml.
so this src is sending a GET request to localhost:3000/pdf/page01.xhtml.
To manipulate this request I created a pages/api/pdf/[...slug].js. In this file you can use process.cwd() to access the file inside your public dir. You read file content using fs.readFile and send the response res.status(200).send(data) like this.
By doing this I was getting the desired result.
Suggestions are always welcome.

xhtml2pdf heroku can't load font

I'm creating a PDF based on xhtml2pdf (Django). In my localhost I need to provide absolute path for font 'D:\user\folder1\folder2\project\static\fonts\DejaVuSansMono.ttf' because reference of {% static 'fonts/DejaVuSansMono.ttf' %} doesn't work. My font isn't loading. If i provide absolute path, it is working fine. But it isn't working when I publish my app on Heroku. I don't know how to do. I know that the xhtml2pdf has reference only on xhtmlpdf catalog (please correct me if I'm wrong).
What should I do that the font will be working on localhost and Heroku too?
I've tried to do something like that but it isn't working as well.
base_url = "{0}://{1}{2}".format(request.scheme, request.get_host(), request.path)
My app in heroku return only /static/fonts/DejaVuSansMono.ttf

AWS Amplify cannot recognize new added file

New to Amplify. Following the tutorial on AWS and everything looks good.
Now I want to add a simple html file, called abc.html, just some basic html code for a test. But when I try to visit the url: https://www.yourdomain.com/abc.html, it redirects the url to https://www.yourdomain.com/abc/. So it basically doesn't recognize there is a file called abc.html. How can I add new files to Amplify?
From Amplify console, everything looks OK. It responded to the git push. Provision, build, deploy, verify are all green. It just can't recognize the new added file. Any suggestions?
I figure out the problem. Post it here in case people have the same problem.
It's a bug in Amplify web framework. If you access the file before the branch gets built and deployed, the web framework can't find the file. So it will show 404 page and record the url as 404. Later, even if you build and deploy the file through Amplify, the web framework still remembers the 404 response to the specific url. It won't refresh. That's why if you add a html file to the repo and access it before Amplify finishes deployment, the file is forever treated as not exist.

Resolve root relative URLs when webapp is deployed to non-empty path

A webapp uses URLs of the form /images/image1.png, i.e. starting with a /.
The webapp should be deployed to a URL of the form http://myhost.example.org/webapp, i.e. the path part of the URL is not empty.
In a default setup the browser would try to get the image from http://myhost.example.org/images/image1.png and fail. What options do exist to make the browser resolve to http://myhost.example.org/webapp/images/image1.png without changing anything in the webapp?
I am using nodejs/keystonejs for the webapp and nginx as a reverse proxy.

Problems with mediaElement.Source and absolute path

I have a SL project that is simply the MediaElement. I embed this in my aspx page and do all the controling of the element from the aspx page throught the java to managed code bridge. I had all my video files in the project as resources for testing but now want to move them out to the server where they will live. The server is in a different domain from my development box but I have access. I can see my files by going to the "run" command and typing that path as follows: "\mediaserver.otherdomain.com\Content\MyVideo.wmv" I can access the folder and view the video's fine from my computer. However, when I do my
`mediaElement.Source = new Uri(MediaPath, UriKind.RelativeOrAbsolute);`
in my code to load the video into Silverlight video does not play. The Media path is "\MediaServer.OtherDomain.com\Content\MyVideo.wmv. I have image files that I reference using the same path "\MediaServer.OtherDomain.com\Content\MyVideo.jpg" and they display fine.
When I debug and look at the values set in the .Source propery I see:
Absolute Path = "/Content/MyVideo.wmv"
Absolute Uri = "file://MediaServer.domain.com/Content/MyVideo.wmv"
Host = "MediaServer.domain.com"
This all looks good, so why don't I see the video?
Silverlight does not allow you to use cross domain references out of the box. You need to add an exception to do so.
If you're using SL4, look at Making a Service Call Across Domain Boundaries

Resources