Link from subdomain-folder of YOURLS to main domain with CORS issue #2979
Replies: 2 comments
-
Is this actually a CORS issue? Needs more information like version numbers, httpd, platform, browser, and most importantly logs from server & browser console. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I would like to create a page like this with YOURLS functionality:
http://yourwish.es
But I have a subfolder like "https://example.com/urls/"
Is it possible to get access from the main domain "example.com" to the subfolder "/urls/" with YOURLS?
I have copied the url bar and the "add_link()"-button to the html-website on the main domain.
All script sources link to the subfolder like this:
<script src="https://example.com/urls/js/common.js?v=1.7.9" type="text/javascript"></script>
On my website all browsers ignored the click on the "add_link()"-button at the main domain, but when I try it on "https://example.com/urls/admin" everything works.
So I try to solve the CORS-issue with a line in config.php:
<?php header("Access-Control-Allow-Origin: http://example.com Vary: Origin");
And in functions-html.php:
function yourls_content_type_header( $type ) { yourls_do_action( 'content_type_header', $type ); if( !headers_sent() ) { $charset = yourls_apply_filter( 'content_type_header_charset', 'utf-8' ); header( "Content-Type: $type; charset=$charset" ); header("Access-Control-Allow-Origin: YOURLS_SITE"); return true; } return false; }
But nothing happens.
What can I do?
Beta Was this translation helpful? Give feedback.
All reactions