I am unable to access the specified file through the direct URL on the VueJS app with Vue Router that is hosted on Ampl

Today, I encountered a persistent issue with my VueJS app hosted on amplify. Everything is running smoothly, except for one thing.

I need to provide direct access to a file (specifically to register an Apple merchant ID with stripe).

I attempted to create a route in my route/index.js that redirects to a component which opens the merchantid file using window.open('myfile'). This solution worked fine locally and in the build, but failed once deployed through amplify built with webpack.

//router/index.js

import WellKnown from '@/components/AppleVerification.vue'
Vue.use(VueRouter)

const routes = [

{
  path: '/.well-known/apple-app-site-association',
  component: WellKnown,
 }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
// AppleVerification.vue

<template>
    <div></div>
</template>

<script>
export default {
  name: 'WellKnown',
  props: {
    file: String
  },
  mounted () {
    window.open('file:///.well-known/apple-developer-merchantid-domain-association')
  }
}
</script>

After trying to set up a redirection in the amplify console with the URL priority and target address as the file, it still did not work as expected.

https://i.stack.imgur.com/ryGMF.png

I am stuck on how to grant access to a file in my sources with a direct URL. Any assistance would be greatly appreciated.
Thank you

Answer №1

The reason for your issue stems from the file access through Amplify, and there are multiple factors at play.

To address this, try the following:

  1. Rename your endfile to "apple-developer-merchantid-domain-association" but add an extension like apple-developer-merchantid-domain-association.txt
  2. Eliminate the dot in your path from public/.well-known/apple-developer-merchantid-domain-association to public/well-known/apple-developer-merchantid-domain-association.txt

In your Amplify console, create a priority 1 rule that redirects https://mydomain/.well-known/apple-developer-merchantid-domain-association to /well-known/apple-develop-merchantid-domain-association.txt using a 202 rexrite method.

Following these steps should resolve the issue.

Furthermore, you may not even need the component anymore.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The idle observer fails to act

Being new to Vue.js, I am encountering an issue with a reactive variable isBtnDigitizePolygonClicked. In the code snippet below, I am trying to trigger certain lines of code as a side effect of the change in the value of isBtnDigitizePolygonClicked, utiliz ...

Passing Parameters Using Axios in Vue.js

Currently, I am utilizing Axios within VueJS to make ajax requests. However, I have encountered an issue when attempting to send these requests. This snippet shows my JavaScript code: axios.post('http://localhost/app/php/search.php', { quer ...

Encountered a problem while trying to deploy my application on Heroku

Hey everyone, I'm facing a tricky error even though I followed all the correct steps. My deployment keeps failing and I can't figure out why. I really need to get my app deployed for a demo, so any help would be greatly appreciated. I've eve ...

Unable to define the color of icons path using CSS in Vue 3

When using the iconify library for VueJS, the icons' paths automatically have "currentColor" as their fill color. The issue arises when trying to set a path's color via CSS, as it seems to be ineffective. Even with "!important", the color won&apo ...

Javascript: Issue encountered while the page was loading

Whenever I make an API call, an error keeps popping up every time the page loads. I can't seem to figure out why it's happening. Can anyone shed some light on this? I've tried to include the link: https://i.stack.imgur.com/3Ul0S.png This ...

Why is my Vue/MySQL Database not showing up online, even though it is accessible locally?

While my application runs smoothly locally, I encounter an issue when deploying to the Heroku server. The page contents linked to the MySQL Database fail to display without any CORS errors or fetch call issues in Chrome Dev Tools. The page loads, but remai ...

Is there a way to pass a v-modal as an array when setting Axios params?

I am currently dealing with a Vue Multiselect setup where the v-model is an array to accommodate multiple selected options. The challenge I am facing involves calling a route within the loadExtraOptions method and passing the array of IDs as a parameter ...

what is the most effective method for integrating Vue with Express?

1: I have successfully installed expressjs on my system. 2: Following that, I used npm to install the vue framework by running 'npm install vue --save'. 3: Additionally, I utilized handlebars as the template-engine for expressjs. In my index.hbs ...

Ways to adjust the width of b-table th

How can I adjust the width of the th to expand the rows of the table like in the screenshot? Is there a way to add a class to th? View what I want here logTableField: [ { key: "LogDate", label: "Tarih",thClass: 'bg-white tex ...

Decoding JSON data from boto3 output

Here is the code I am using to retrieve IAM users: #!/usr/bin/env python import boto3 import json client = boto3.client('iam') response = client.list_users( ) print response Upon running the code, the followin ...

Trouble with V-if not updating after property is modified within an async TypeScript function

There is a scenario where one HTML element becomes hidden after an async call returns from the server, while another HTML element is displayed: <template> <div v-if="!showElementTwo">Element 1</div> <div v-if="show ...

Tips for incorporating VueJS 2 global components within single file components

As I attempt to utilize a globally registered component (using Vue.component) within a single file component, I consistently encounter the following warning: vue.common.js:2611[Vue warn]: Unknown custom element: <my-component> - did you register the ...

Implement a formatter function to manipulate the JSON data retrieved from a REST API within the BootstrapVue framework

My bootstrap-vue vue.js v2.6 app is receiving JSON data from a REST API. The data structure looks like this: { "fields": [ { "key": "name", "label": "name", & ...

The Ionic CLI version 6.x is currently in the process of establishing connectivity with the vue-cli-service, causing a spike in CPU usage up

I recently integrated Ionic 6 into my new Vue 3 project and encountered an issue when running npx ionic serve. The build process and serving of the project work as expected, but it seems to be causing a processor to run at 100%, leading to what looks like ...

Issue with VueJS and Jest: Module 'babel-core' not found

While attempting to integrate Jest with VueJS, I encountered an issue: Cannot find module 'babel-core' at Object.<anonymous> (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15). To resolve this, I had to include "@babel/core": " ...

Presenting Findings Generated by the AWS CloudSearch Solution

Looking for a solution to efficiently display JSON results from AWS CloudSearch? Check out the example link provided below. I want to create a user-friendly interface that integrates facet functionality and is easy to implement. Attached is a demo search i ...

Effortlessly implement CSS styling in a scoped shadow element with Vue3

I am facing an issue with applying styles to an anchor element in my code. Below is a snippet of the code: <template> <custom-button> #shadow-root (open) <a href="#"></a> <other-custom></other-c ...

Discover the magic of triggering events that dynamically alter CSS styles

I am trying to implement an eventBus in the App.vue component that allows me to change a modal's CSS based on a payload object. For example, if I pass { type: 'success' }, the border of the modal should turn green, and if I pass { type: &apo ...

Should you include the dollar sign in a Vue HTML variable or not?

I’m a bit confused about whether or not I should include $ when using a Vue HTML variable: new Vue({ data: { a: "myData" } }); Do I need to use: <h1>My value is {{ a }}</h1> or <h1>My value is {{ $a }}</h1> What ...

The event listener for the custom cursor in Nuxt.js is failing to work properly when the route

I am currently in the process of constructing a new website for our studio, but am encountering difficulties with getting the custom cursor to function correctly. I implemented a custom cursor using gsap, and it worked perfectly; however, once I navigate t ...